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-2014 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, see <http://www.gnu.org/licenses/>. */
21 @PRAGMA_SYSTEM_HEADER@
25 #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
26 /* Special invocation convention:
27 - Inside glibc header files.
28 - On OSF/1 5.1 we have a sequence of nested includes
29 <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
30 <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
31 In this situation, the functions are not yet declared, therefore we cannot
32 provide the C++ aliases. */
34 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
37 /* Normal invocation convention. */
39 #ifndef _@GUARD_PREFIX@_STDIO_H
41 #define _GL_ALREADY_INCLUDING_STDIO_H
43 /* The include_next requires a split double-inclusion guard. */
44 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
46 #undef _GL_ALREADY_INCLUDING_STDIO_H
48 #ifndef _@GUARD_PREFIX@_STDIO_H
49 #define _@GUARD_PREFIX@_STDIO_H
51 /* Get va_list. Needed on many systems, including glibc 2.8. */
56 /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
58 May also define off_t to a 64-bit type on native Windows. */
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)
129 /* When also using extern inline, suppress the use of static inline in
130 standard headers of problematic Apple configurations, as Libc at
131 least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
132 <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
133 Perhaps Apple will fix this some day. */
134 #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
135 && defined __GNUC__ && defined __STDC__)
136 # undef putc_unlocked
140 # if @REPLACE_DPRINTF@
141 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
142 # define dprintf rpl_dprintf
144 _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
145 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
146 _GL_ARG_NONNULL ((2)));
147 _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
150 _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
151 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
152 _GL_ARG_NONNULL ((2)));
154 _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
156 _GL_CXXALIASWARN (dprintf);
157 #elif defined GNULIB_POSIXCHECK
159 # if HAVE_RAW_DECL_DPRINTF
160 _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
161 "use gnulib module dprintf for portability");
166 /* Close STREAM and its underlying file descriptor. */
167 # if @REPLACE_FCLOSE@
168 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
169 # define fclose rpl_fclose
171 _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
172 _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
174 _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
176 _GL_CXXALIASWARN (fclose);
177 #elif defined GNULIB_POSIXCHECK
179 /* Assume fclose is always declared. */
180 _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
181 "use gnulib module fclose for portable POSIX compliance");
185 # if @REPLACE_FDOPEN@
186 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
188 # define fdopen rpl_fdopen
190 _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
191 _GL_ARG_NONNULL ((2)));
192 _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
194 _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
196 _GL_CXXALIASWARN (fdopen);
197 #elif defined GNULIB_POSIXCHECK
199 /* Assume fdopen is always declared. */
200 _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
201 "use gnulib module fdopen for portability");
205 /* Flush all pending data on STREAM according to POSIX rules. Both
206 output and seekable input streams are supported.
207 Note! LOSS OF DATA can occur if fflush is applied on an input stream
208 that is _not_seekable_ or on an update stream that is _not_seekable_
209 and in which the most recent operation was input. Seekability can
210 be tested with lseek(fileno(fp),0,SEEK_CUR). */
211 # if @REPLACE_FFLUSH@
212 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
213 # define fflush rpl_fflush
215 _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
216 _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
218 _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
220 _GL_CXXALIASWARN (fflush);
221 #elif defined GNULIB_POSIXCHECK
223 /* Assume fflush is always declared. */
224 _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
225 "use gnulib module fflush for portable POSIX compliance");
229 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
230 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
232 # define fgetc rpl_fgetc
234 _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
235 _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
237 _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
239 _GL_CXXALIASWARN (fgetc);
243 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
244 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
246 # define fgets rpl_fgets
248 _GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
249 _GL_ARG_NONNULL ((1, 3)));
250 _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
252 _GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
254 _GL_CXXALIASWARN (fgets);
259 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
261 # define fopen rpl_fopen
263 _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
264 _GL_ARG_NONNULL ((1, 2)));
265 _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
267 _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
269 _GL_CXXALIASWARN (fopen);
270 #elif defined GNULIB_POSIXCHECK
272 /* Assume fopen is always declared. */
273 _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
274 "use gnulib module fopen for portability");
277 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
278 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
279 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
280 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
281 # define fprintf rpl_fprintf
283 # define GNULIB_overrides_fprintf 1
284 # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
285 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
286 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
287 _GL_ARG_NONNULL ((1, 2)));
289 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
290 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
291 _GL_ARG_NONNULL ((1, 2)));
293 _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
295 _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
297 _GL_CXXALIASWARN (fprintf);
299 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
300 # if !GNULIB_overrides_fprintf
303 /* Assume fprintf is always declared. */
304 _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
305 "use gnulib module fprintf-posix for portable "
310 /* Discard all pending buffered I/O data on STREAM.
311 STREAM must not be wide-character oriented.
312 When discarding pending output, the file position is set back to where it
313 was before the write calls. When discarding pending input, the file
314 position is advanced to match the end of the previously read input.
315 Return 0 if successful. Upon error, return -1 and set errno. */
316 # if @REPLACE_FPURGE@
317 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
318 # define fpurge rpl_fpurge
320 _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
321 _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
323 # if !@HAVE_DECL_FPURGE@
324 _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
326 _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
328 _GL_CXXALIASWARN (fpurge);
329 #elif defined GNULIB_POSIXCHECK
331 # if HAVE_RAW_DECL_FPURGE
332 _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
333 "use gnulib module fpurge for portability");
338 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
339 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
341 # define fputc rpl_fputc
343 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
344 _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
346 _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
348 _GL_CXXALIASWARN (fputc);
352 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
353 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
355 # define fputs rpl_fputs
357 _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
358 _GL_ARG_NONNULL ((1, 2)));
359 _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
361 _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
363 _GL_CXXALIASWARN (fputs);
367 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
368 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
370 # define fread rpl_fread
372 _GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
373 _GL_ARG_NONNULL ((4)));
374 _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
376 _GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
378 _GL_CXXALIASWARN (fread);
382 # if @REPLACE_FREOPEN@
383 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
385 # define freopen rpl_freopen
387 _GL_FUNCDECL_RPL (freopen, FILE *,
388 (const char *filename, const char *mode, FILE *stream)
389 _GL_ARG_NONNULL ((2, 3)));
390 _GL_CXXALIAS_RPL (freopen, FILE *,
391 (const char *filename, const char *mode, FILE *stream));
393 _GL_CXXALIAS_SYS (freopen, FILE *,
394 (const char *filename, const char *mode, FILE *stream));
396 _GL_CXXALIASWARN (freopen);
397 #elif defined GNULIB_POSIXCHECK
399 /* Assume freopen is always declared. */
400 _GL_WARN_ON_USE (freopen,
401 "freopen on native Windows platforms is not POSIX compliant - "
402 "use gnulib module freopen for portability");
406 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
407 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
409 # define fscanf rpl_fscanf
411 _GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
412 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
413 _GL_ARG_NONNULL ((1, 2)));
414 _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
416 _GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
418 _GL_CXXALIASWARN (fscanf);
422 /* Set up the following warnings, based on which modules are in use.
423 GNU Coding Standards discourage the use of fseek, since it imposes
424 an arbitrary limitation on some 32-bit hosts. Remember that the
425 fseek module depends on the fseeko module, so we only have three
428 1. The developer is not using either module. Issue a warning under
429 GNULIB_POSIXCHECK for both functions, to remind them that both
430 functions have bugs on some systems. _GL_NO_LARGE_FILES has no
431 impact on this warning.
433 2. The developer is using both modules. They may be unaware of the
434 arbitrary limitations of fseek, so issue a warning under
435 GNULIB_POSIXCHECK. On the other hand, they may be using both
436 modules intentionally, so the developer can define
437 _GL_NO_LARGE_FILES in the compilation units where the use of fseek
438 is safe, to silence the warning.
440 3. The developer is using the fseeko module, but not fseek. Gnulib
441 guarantees that fseek will still work around platform bugs in that
442 case, but we presume that the developer is aware of the pitfalls of
443 fseek and was trying to avoid it, so issue a warning even when
444 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
445 defined to silence the warning in particular compilation units.
446 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
447 fseek gets defined as a macro, it is recommended that the developer
448 uses the fseek module, even if he is not calling the fseek function.
450 Most gnulib clients that perform stream operations should fall into
454 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
455 # define _GL_FSEEK_WARN /* Category 2, above. */
459 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
461 # define fseek rpl_fseek
463 _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
464 _GL_ARG_NONNULL ((1)));
465 _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
467 _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
469 _GL_CXXALIASWARN (fseek);
473 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
474 # define _GL_FSEEK_WARN /* Category 3, above. */
477 # if @REPLACE_FSEEKO@
478 /* Provide an fseeko function that is aware of a preceding fflush(), and which
480 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
482 # define fseeko rpl_fseeko
484 _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
485 _GL_ARG_NONNULL ((1)));
486 _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
488 # if ! @HAVE_DECL_FSEEKO@
489 _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
490 _GL_ARG_NONNULL ((1)));
492 _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
494 _GL_CXXALIASWARN (fseeko);
495 #elif defined GNULIB_POSIXCHECK
496 # define _GL_FSEEK_WARN /* Category 1, above. */
499 # if HAVE_RAW_DECL_FSEEKO
500 _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
501 "use gnulib module fseeko for portability");
505 #ifdef _GL_FSEEK_WARN
506 # undef _GL_FSEEK_WARN
507 /* Here, either fseek is undefined (but C89 guarantees that it is
508 declared), or it is defined as rpl_fseek (declared above). */
509 _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
510 "on 32-bit platforms - "
511 "use fseeko function for handling of large files");
515 /* ftell, ftello. See the comments on fseek/fseeko. */
518 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
519 # define _GL_FTELL_WARN /* Category 2, above. */
523 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
525 # define ftell rpl_ftell
527 _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
528 _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
530 _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
532 _GL_CXXALIASWARN (ftell);
536 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
537 # define _GL_FTELL_WARN /* Category 3, above. */
540 # if @REPLACE_FTELLO@
541 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
543 # define ftello rpl_ftello
545 _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
546 _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
548 # if ! @HAVE_DECL_FTELLO@
549 _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
551 _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
553 _GL_CXXALIASWARN (ftello);
554 #elif defined GNULIB_POSIXCHECK
555 # define _GL_FTELL_WARN /* Category 1, above. */
558 # if HAVE_RAW_DECL_FTELLO
559 _GL_WARN_ON_USE (ftello, "ftello is unportable - "
560 "use gnulib module ftello for portability");
564 #ifdef _GL_FTELL_WARN
565 # undef _GL_FTELL_WARN
566 /* Here, either ftell is undefined (but C89 guarantees that it is
567 declared), or it is defined as rpl_ftell (declared above). */
568 _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
569 "on 32-bit platforms - "
570 "use ftello function for handling of large files");
575 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
576 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
578 # define fwrite rpl_fwrite
580 _GL_FUNCDECL_RPL (fwrite, size_t,
581 (const void *ptr, size_t s, size_t n, FILE *stream)
582 _GL_ARG_NONNULL ((1, 4)));
583 _GL_CXXALIAS_RPL (fwrite, size_t,
584 (const void *ptr, size_t s, size_t n, FILE *stream));
586 _GL_CXXALIAS_SYS (fwrite, size_t,
587 (const void *ptr, size_t s, size_t n, FILE *stream));
589 /* Work around bug 11959 when fortifying glibc 2.4 through 2.15
590 <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
591 which sometimes causes an unwanted diagnostic for fwrite calls.
592 This affects only function declaration attributes under certain
593 versions of gcc and clang, and is not needed for C++. */
594 # if (0 < __USE_FORTIFY_LEVEL \
595 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
596 && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
597 && !defined __cplusplus)
599 # undef fwrite_unlocked
600 extern size_t __REDIRECT (rpl_fwrite,
601 (const void *__restrict, size_t, size_t,
604 extern size_t __REDIRECT (rpl_fwrite_unlocked,
605 (const void *__restrict, size_t, size_t,
608 # define fwrite rpl_fwrite
609 # define fwrite_unlocked rpl_fwrite_unlocked
612 _GL_CXXALIASWARN (fwrite);
616 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
617 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
619 # define getc rpl_fgetc
621 _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
622 _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
624 _GL_CXXALIAS_SYS (getc, int, (FILE *stream));
626 _GL_CXXALIASWARN (getc);
630 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
631 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
633 # define getchar rpl_getchar
635 _GL_FUNCDECL_RPL (getchar, int, (void));
636 _GL_CXXALIAS_RPL (getchar, int, (void));
638 _GL_CXXALIAS_SYS (getchar, int, (void));
640 _GL_CXXALIASWARN (getchar);
643 #if @GNULIB_GETDELIM@
644 /* Read input, up to (and including) the next occurrence of DELIMITER, from
645 STREAM, store it in *LINEPTR (and NUL-terminate it).
646 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
647 bytes of space. It is realloc'd as necessary.
648 Return the number of bytes read and stored at *LINEPTR (not including the
649 NUL terminator), or -1 on error or EOF. */
650 # if @REPLACE_GETDELIM@
651 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
653 # define getdelim rpl_getdelim
655 _GL_FUNCDECL_RPL (getdelim, ssize_t,
656 (char **lineptr, size_t *linesize, int delimiter,
658 _GL_ARG_NONNULL ((1, 2, 4)));
659 _GL_CXXALIAS_RPL (getdelim, ssize_t,
660 (char **lineptr, size_t *linesize, int delimiter,
663 # if !@HAVE_DECL_GETDELIM@
664 _GL_FUNCDECL_SYS (getdelim, ssize_t,
665 (char **lineptr, size_t *linesize, int delimiter,
667 _GL_ARG_NONNULL ((1, 2, 4)));
669 _GL_CXXALIAS_SYS (getdelim, ssize_t,
670 (char **lineptr, size_t *linesize, int delimiter,
673 _GL_CXXALIASWARN (getdelim);
674 #elif defined GNULIB_POSIXCHECK
676 # if HAVE_RAW_DECL_GETDELIM
677 _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
678 "use gnulib module getdelim for portability");
683 /* Read a line, up to (and including) the next newline, from STREAM, store it
684 in *LINEPTR (and NUL-terminate it).
685 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
686 bytes of space. It is realloc'd as necessary.
687 Return the number of bytes read and stored at *LINEPTR (not including the
688 NUL terminator), or -1 on error or EOF. */
689 # if @REPLACE_GETLINE@
690 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
692 # define getline rpl_getline
694 _GL_FUNCDECL_RPL (getline, ssize_t,
695 (char **lineptr, size_t *linesize, FILE *stream)
696 _GL_ARG_NONNULL ((1, 2, 3)));
697 _GL_CXXALIAS_RPL (getline, ssize_t,
698 (char **lineptr, size_t *linesize, FILE *stream));
700 # if !@HAVE_DECL_GETLINE@
701 _GL_FUNCDECL_SYS (getline, ssize_t,
702 (char **lineptr, size_t *linesize, FILE *stream)
703 _GL_ARG_NONNULL ((1, 2, 3)));
705 _GL_CXXALIAS_SYS (getline, ssize_t,
706 (char **lineptr, size_t *linesize, FILE *stream));
708 # if @HAVE_DECL_GETLINE@
709 _GL_CXXALIASWARN (getline);
711 #elif defined GNULIB_POSIXCHECK
713 # if HAVE_RAW_DECL_GETLINE
714 _GL_WARN_ON_USE (getline, "getline is unportable - "
715 "use gnulib module getline for portability");
719 /* It is very rare that the developer ever has full control of stdin,
720 so any use of gets warrants an unconditional warning; besides, C11
723 #if HAVE_RAW_DECL_GETS
724 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
728 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
730 /* Grow an obstack with formatted output. Return the number of
731 bytes added to OBS. No trailing nul byte is added, and the
732 object should be closed with obstack_finish before use. Upon
733 memory allocation error, call obstack_alloc_failed_handler. Upon
734 other error, return -1. */
735 # if @REPLACE_OBSTACK_PRINTF@
736 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
737 # define obstack_printf rpl_obstack_printf
739 _GL_FUNCDECL_RPL (obstack_printf, int,
740 (struct obstack *obs, const char *format, ...)
741 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
742 _GL_ARG_NONNULL ((1, 2)));
743 _GL_CXXALIAS_RPL (obstack_printf, int,
744 (struct obstack *obs, const char *format, ...));
746 # if !@HAVE_DECL_OBSTACK_PRINTF@
747 _GL_FUNCDECL_SYS (obstack_printf, int,
748 (struct obstack *obs, const char *format, ...)
749 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
750 _GL_ARG_NONNULL ((1, 2)));
752 _GL_CXXALIAS_SYS (obstack_printf, int,
753 (struct obstack *obs, const char *format, ...));
755 _GL_CXXALIASWARN (obstack_printf);
756 # if @REPLACE_OBSTACK_PRINTF@
757 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
758 # define obstack_vprintf rpl_obstack_vprintf
760 _GL_FUNCDECL_RPL (obstack_vprintf, int,
761 (struct obstack *obs, const char *format, va_list args)
762 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
763 _GL_ARG_NONNULL ((1, 2)));
764 _GL_CXXALIAS_RPL (obstack_vprintf, int,
765 (struct obstack *obs, const char *format, va_list args));
767 # if !@HAVE_DECL_OBSTACK_PRINTF@
768 _GL_FUNCDECL_SYS (obstack_vprintf, int,
769 (struct obstack *obs, const char *format, va_list args)
770 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
771 _GL_ARG_NONNULL ((1, 2)));
773 _GL_CXXALIAS_SYS (obstack_vprintf, int,
774 (struct obstack *obs, const char *format, va_list args));
776 _GL_CXXALIASWARN (obstack_vprintf);
781 _GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
783 _GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
784 _GL_CXXALIASWARN (pclose);
785 #elif defined GNULIB_POSIXCHECK
787 # if HAVE_RAW_DECL_PCLOSE
788 _GL_WARN_ON_USE (pclose, "pclose is unportable - "
789 "use gnulib module pclose for more portability");
794 /* Print a message to standard error, describing the value of ERRNO,
795 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
796 and terminated with a newline. */
797 # if @REPLACE_PERROR@
798 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
799 # define perror rpl_perror
801 _GL_FUNCDECL_RPL (perror, void, (const char *string));
802 _GL_CXXALIAS_RPL (perror, void, (const char *string));
804 _GL_CXXALIAS_SYS (perror, void, (const char *string));
806 _GL_CXXALIASWARN (perror);
807 #elif defined GNULIB_POSIXCHECK
809 /* Assume perror is always declared. */
810 _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
811 "use gnulib module perror for portability");
816 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
818 # define popen rpl_popen
820 _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
821 _GL_ARG_NONNULL ((1, 2)));
822 _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
825 _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode)
826 _GL_ARG_NONNULL ((1, 2)));
828 _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
830 _GL_CXXALIASWARN (popen);
831 #elif defined GNULIB_POSIXCHECK
833 # if HAVE_RAW_DECL_POPEN
834 _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
835 "use gnulib module popen or pipe for more portability");
839 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
840 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
841 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
842 # if defined __GNUC__
843 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
844 /* Don't break __attribute__((format(printf,M,N))). */
845 # define printf __printf__
847 # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
848 _GL_FUNCDECL_RPL_1 (__printf__, int,
849 (const char *format, ...)
850 __asm__ (@ASM_SYMBOL_PREFIX@
851 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
852 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
853 _GL_ARG_NONNULL ((1)));
855 _GL_FUNCDECL_RPL_1 (__printf__, int,
856 (const char *format, ...)
857 __asm__ (@ASM_SYMBOL_PREFIX@
858 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
859 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
860 _GL_ARG_NONNULL ((1)));
862 _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
864 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
865 # define printf rpl_printf
867 _GL_FUNCDECL_RPL (printf, int,
868 (const char *format, ...)
869 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
870 _GL_ARG_NONNULL ((1)));
871 _GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
873 # define GNULIB_overrides_printf 1
875 _GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
877 _GL_CXXALIASWARN (printf);
879 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
880 # if !GNULIB_overrides_printf
883 /* Assume printf is always declared. */
884 _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
885 "use gnulib module printf-posix for portable "
890 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
891 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
893 # define putc rpl_fputc
895 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
896 _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
898 _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
900 _GL_CXXALIASWARN (putc);
904 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
905 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
907 # define putchar rpl_putchar
909 _GL_FUNCDECL_RPL (putchar, int, (int c));
910 _GL_CXXALIAS_RPL (putchar, int, (int c));
912 _GL_CXXALIAS_SYS (putchar, int, (int c));
914 _GL_CXXALIASWARN (putchar);
918 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
919 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
921 # define puts rpl_puts
923 _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
924 _GL_CXXALIAS_RPL (puts, int, (const char *string));
926 _GL_CXXALIAS_SYS (puts, int, (const char *string));
928 _GL_CXXALIASWARN (puts);
932 # if @REPLACE_REMOVE@
933 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
935 # define remove rpl_remove
937 _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
938 _GL_CXXALIAS_RPL (remove, int, (const char *name));
940 _GL_CXXALIAS_SYS (remove, int, (const char *name));
942 _GL_CXXALIASWARN (remove);
943 #elif defined GNULIB_POSIXCHECK
945 /* Assume remove is always declared. */
946 _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
947 "use gnulib module remove for more portability");
951 # if @REPLACE_RENAME@
952 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
954 # define rename rpl_rename
956 _GL_FUNCDECL_RPL (rename, int,
957 (const char *old_filename, const char *new_filename)
958 _GL_ARG_NONNULL ((1, 2)));
959 _GL_CXXALIAS_RPL (rename, int,
960 (const char *old_filename, const char *new_filename));
962 _GL_CXXALIAS_SYS (rename, int,
963 (const char *old_filename, const char *new_filename));
965 _GL_CXXALIASWARN (rename);
966 #elif defined GNULIB_POSIXCHECK
968 /* Assume rename is always declared. */
969 _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
970 "use gnulib module rename for more portability");
973 #if @GNULIB_RENAMEAT@
974 # if @REPLACE_RENAMEAT@
975 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
977 # define renameat rpl_renameat
979 _GL_FUNCDECL_RPL (renameat, int,
980 (int fd1, char const *file1, int fd2, char const *file2)
981 _GL_ARG_NONNULL ((2, 4)));
982 _GL_CXXALIAS_RPL (renameat, int,
983 (int fd1, char const *file1, int fd2, char const *file2));
985 # if !@HAVE_RENAMEAT@
986 _GL_FUNCDECL_SYS (renameat, int,
987 (int fd1, char const *file1, int fd2, char const *file2)
988 _GL_ARG_NONNULL ((2, 4)));
990 _GL_CXXALIAS_SYS (renameat, int,
991 (int fd1, char const *file1, int fd2, char const *file2));
993 _GL_CXXALIASWARN (renameat);
994 #elif defined GNULIB_POSIXCHECK
996 # if HAVE_RAW_DECL_RENAMEAT
997 _GL_WARN_ON_USE (renameat, "renameat is not portable - "
998 "use gnulib module renameat for portability");
1003 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1004 # if defined __GNUC__
1005 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1007 /* Don't break __attribute__((format(scanf,M,N))). */
1008 # define scanf __scanf__
1010 _GL_FUNCDECL_RPL_1 (__scanf__, int,
1011 (const char *format, ...)
1012 __asm__ (@ASM_SYMBOL_PREFIX@
1013 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
1014 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1015 _GL_ARG_NONNULL ((1)));
1016 _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
1018 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1020 # define scanf rpl_scanf
1022 _GL_FUNCDECL_RPL (scanf, int, (const char *format, ...)
1023 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1024 _GL_ARG_NONNULL ((1)));
1025 _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
1028 _GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
1030 _GL_CXXALIASWARN (scanf);
1033 #if @GNULIB_SNPRINTF@
1034 # if @REPLACE_SNPRINTF@
1035 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1036 # define snprintf rpl_snprintf
1038 _GL_FUNCDECL_RPL (snprintf, int,
1039 (char *str, size_t size, const char *format, ...)
1040 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
1041 _GL_ARG_NONNULL ((3)));
1042 _GL_CXXALIAS_RPL (snprintf, int,
1043 (char *str, size_t size, const char *format, ...));
1045 # if !@HAVE_DECL_SNPRINTF@
1046 _GL_FUNCDECL_SYS (snprintf, int,
1047 (char *str, size_t size, const char *format, ...)
1048 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
1049 _GL_ARG_NONNULL ((3)));
1051 _GL_CXXALIAS_SYS (snprintf, int,
1052 (char *str, size_t size, const char *format, ...));
1054 _GL_CXXALIASWARN (snprintf);
1055 #elif defined GNULIB_POSIXCHECK
1057 # if HAVE_RAW_DECL_SNPRINTF
1058 _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1059 "use gnulib module snprintf for portability");
1063 /* Some people would argue that all sprintf uses should be warned about
1064 (for example, OpenBSD issues a link warning for it),
1065 since it can cause security holes due to buffer overruns.
1066 However, we believe that sprintf can be used safely, and is more
1067 efficient than snprintf in those safe cases; and as proof of our
1068 belief, we use sprintf in several gnulib modules. So this header
1069 intentionally avoids adding a warning to sprintf except when
1070 GNULIB_POSIXCHECK is defined. */
1072 #if @GNULIB_SPRINTF_POSIX@
1073 # if @REPLACE_SPRINTF@
1074 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1075 # define sprintf rpl_sprintf
1077 _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
1078 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1079 _GL_ARG_NONNULL ((1, 2)));
1080 _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
1082 _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
1084 _GL_CXXALIASWARN (sprintf);
1085 #elif defined GNULIB_POSIXCHECK
1087 /* Assume sprintf is always declared. */
1088 _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
1089 "use gnulib module sprintf-posix for portable "
1090 "POSIX compliance");
1093 #if @GNULIB_TMPFILE@
1094 # if @REPLACE_TMPFILE@
1095 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1096 # define tmpfile rpl_tmpfile
1098 _GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
1099 _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1101 _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1103 _GL_CXXALIASWARN (tmpfile);
1104 #elif defined GNULIB_POSIXCHECK
1106 # if HAVE_RAW_DECL_TMPFILE
1107 _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1108 "use gnulib module tmpfile for portability");
1112 #if @GNULIB_VASPRINTF@
1113 /* Write formatted output to a string dynamically allocated with malloc().
1114 If the memory allocation succeeds, store the address of the string in
1115 *RESULT and return the number of resulting bytes, excluding the trailing
1116 NUL. Upon memory allocation error, or some other error, return -1. */
1117 # if @REPLACE_VASPRINTF@
1118 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1119 # define asprintf rpl_asprintf
1121 _GL_FUNCDECL_RPL (asprintf, int,
1122 (char **result, const char *format, ...)
1123 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1124 _GL_ARG_NONNULL ((1, 2)));
1125 _GL_CXXALIAS_RPL (asprintf, int,
1126 (char **result, const char *format, ...));
1128 # if !@HAVE_VASPRINTF@
1129 _GL_FUNCDECL_SYS (asprintf, int,
1130 (char **result, const char *format, ...)
1131 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1132 _GL_ARG_NONNULL ((1, 2)));
1134 _GL_CXXALIAS_SYS (asprintf, int,
1135 (char **result, const char *format, ...));
1137 _GL_CXXALIASWARN (asprintf);
1138 # if @REPLACE_VASPRINTF@
1139 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1140 # define vasprintf rpl_vasprintf
1142 _GL_FUNCDECL_RPL (vasprintf, int,
1143 (char **result, const char *format, va_list args)
1144 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1145 _GL_ARG_NONNULL ((1, 2)));
1146 _GL_CXXALIAS_RPL (vasprintf, int,
1147 (char **result, const char *format, va_list args));
1149 # if !@HAVE_VASPRINTF@
1150 _GL_FUNCDECL_SYS (vasprintf, int,
1151 (char **result, const char *format, va_list args)
1152 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1153 _GL_ARG_NONNULL ((1, 2)));
1155 _GL_CXXALIAS_SYS (vasprintf, int,
1156 (char **result, const char *format, va_list args));
1158 _GL_CXXALIASWARN (vasprintf);
1161 #if @GNULIB_VDPRINTF@
1162 # if @REPLACE_VDPRINTF@
1163 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1164 # define vdprintf rpl_vdprintf
1166 _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
1167 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1168 _GL_ARG_NONNULL ((2)));
1169 _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
1171 # if !@HAVE_VDPRINTF@
1172 _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
1173 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1174 _GL_ARG_NONNULL ((2)));
1176 /* Need to cast, because on Solaris, the third parameter will likely be
1178 _GL_CXXALIAS_SYS_CAST (vdprintf, int,
1179 (int fd, const char *format, va_list args));
1181 _GL_CXXALIASWARN (vdprintf);
1182 #elif defined GNULIB_POSIXCHECK
1184 # if HAVE_RAW_DECL_VDPRINTF
1185 _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1186 "use gnulib module vdprintf for portability");
1190 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1191 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1192 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1193 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1194 # define vfprintf rpl_vfprintf
1196 # define GNULIB_overrides_vfprintf 1
1197 # if @GNULIB_VFPRINTF_POSIX@
1198 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
1199 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1200 _GL_ARG_NONNULL ((1, 2)));
1202 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
1203 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1204 _GL_ARG_NONNULL ((1, 2)));
1206 _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
1208 /* Need to cast, because on Solaris, the third parameter is
1210 and GCC's fixincludes did not change this to __gnuc_va_list. */
1211 _GL_CXXALIAS_SYS_CAST (vfprintf, int,
1212 (FILE *fp, const char *format, va_list args));
1214 _GL_CXXALIASWARN (vfprintf);
1216 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1217 # if !GNULIB_overrides_vfprintf
1220 /* Assume vfprintf is always declared. */
1221 _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1222 "use gnulib module vfprintf-posix for portable "
1223 "POSIX compliance");
1226 #if @GNULIB_VFSCANF@
1227 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1228 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1230 # define vfscanf rpl_vfscanf
1232 _GL_FUNCDECL_RPL (vfscanf, int,
1233 (FILE *stream, const char *format, va_list args)
1234 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1235 _GL_ARG_NONNULL ((1, 2)));
1236 _GL_CXXALIAS_RPL (vfscanf, int,
1237 (FILE *stream, const char *format, va_list args));
1239 _GL_CXXALIAS_SYS (vfscanf, int,
1240 (FILE *stream, const char *format, va_list args));
1242 _GL_CXXALIASWARN (vfscanf);
1245 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1246 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1247 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1248 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1249 # define vprintf rpl_vprintf
1251 # define GNULIB_overrides_vprintf 1
1252 # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1253 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
1254 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
1255 _GL_ARG_NONNULL ((1)));
1257 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
1258 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1259 _GL_ARG_NONNULL ((1)));
1261 _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
1263 /* Need to cast, because on Solaris, the second parameter is
1265 and GCC's fixincludes did not change this to __gnuc_va_list. */
1266 _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
1268 _GL_CXXALIASWARN (vprintf);
1270 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1271 # if !GNULIB_overrides_vprintf
1274 /* Assume vprintf is always declared. */
1275 _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1276 "use gnulib module vprintf-posix for portable "
1277 "POSIX compliance");
1281 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1282 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1284 # define vscanf rpl_vscanf
1286 _GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args)
1287 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1288 _GL_ARG_NONNULL ((1)));
1289 _GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
1291 _GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
1293 _GL_CXXALIASWARN (vscanf);
1296 #if @GNULIB_VSNPRINTF@
1297 # if @REPLACE_VSNPRINTF@
1298 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1299 # define vsnprintf rpl_vsnprintf
1301 _GL_FUNCDECL_RPL (vsnprintf, int,
1302 (char *str, size_t size, const char *format, va_list args)
1303 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1304 _GL_ARG_NONNULL ((3)));
1305 _GL_CXXALIAS_RPL (vsnprintf, int,
1306 (char *str, size_t size, const char *format, va_list args));
1308 # if !@HAVE_DECL_VSNPRINTF@
1309 _GL_FUNCDECL_SYS (vsnprintf, int,
1310 (char *str, size_t size, const char *format, va_list args)
1311 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1312 _GL_ARG_NONNULL ((3)));
1314 _GL_CXXALIAS_SYS (vsnprintf, int,
1315 (char *str, size_t size, const char *format, va_list args));
1317 _GL_CXXALIASWARN (vsnprintf);
1318 #elif defined GNULIB_POSIXCHECK
1320 # if HAVE_RAW_DECL_VSNPRINTF
1321 _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1322 "use gnulib module vsnprintf for portability");
1326 #if @GNULIB_VSPRINTF_POSIX@
1327 # if @REPLACE_VSPRINTF@
1328 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1329 # define vsprintf rpl_vsprintf
1331 _GL_FUNCDECL_RPL (vsprintf, int,
1332 (char *str, const char *format, va_list args)
1333 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1334 _GL_ARG_NONNULL ((1, 2)));
1335 _GL_CXXALIAS_RPL (vsprintf, int,
1336 (char *str, const char *format, va_list args));
1338 /* Need to cast, because on Solaris, the third parameter is
1340 and GCC's fixincludes did not change this to __gnuc_va_list. */
1341 _GL_CXXALIAS_SYS_CAST (vsprintf, int,
1342 (char *str, const char *format, va_list args));
1344 _GL_CXXALIASWARN (vsprintf);
1345 #elif defined GNULIB_POSIXCHECK
1347 /* Assume vsprintf is always declared. */
1348 _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
1349 "use gnulib module vsprintf-posix for portable "
1350 "POSIX compliance");
1353 #endif /* _@GUARD_PREFIX@_STDIO_H */
1354 #endif /* _@GUARD_PREFIX@_STDIO_H */