1 /* A GNU-like <stdio.h>.
3 Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 @PRAGMA_SYSTEM_HEADER@
24 #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
25 /* Special invocation convention:
26 - Inside glibc header files.
27 - On OSF/1 5.1 we have a sequence of nested includes
28 <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
29 <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
30 In this situation, the functions are not yet declared, therefore we cannot
31 provide the C++ aliases. */
33 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
36 /* Normal invocation convention. */
40 #define _GL_ALREADY_INCLUDING_STDIO_H
42 /* The include_next requires a split double-inclusion guard. */
43 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
45 #undef _GL_ALREADY_INCLUDING_STDIO_H
50 /* Get va_list. Needed on many systems, including glibc 2.8. */
55 /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
57 #include <sys/types.h>
59 /* The __attribute__ feature is available in gcc versions 2.5 and later.
60 The __-protected variants of the attributes 'format' and 'printf' are
61 accepted by gcc versions 2.6.4 (effectively 2.7) and later.
62 We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
63 gnulib and libintl do '#define printf __printf__' when they override
64 the 'printf' function. */
65 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
66 # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
68 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
71 /* _GL_ATTRIBUTE_FORMAT_PRINTF
72 indicates to GCC that the function takes a format string and arguments,
73 where the format string directives are the ones standardized by ISO C99
75 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
76 # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
77 _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
79 # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
80 _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
83 /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
84 except that it indicates to GCC that the supported format string directives
85 are the ones of the system printf(), rather than the ones standardized by
87 #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
88 _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
90 /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
91 /* But in any case avoid namespace pollution on glibc systems. */
92 #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
93 && ! defined __GLIBC__
98 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
100 /* The definition of _GL_ARG_NONNULL is copied here. */
102 /* The definition of _GL_WARN_ON_USE is copied here. */
104 /* Macros for stringification. */
105 #define _GL_STDIO_STRINGIZE(token) #token
106 #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
110 # if @REPLACE_DPRINTF@
111 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
112 # define dprintf rpl_dprintf
114 _GL_FUNCDECL_RPL (dprintf
, int, (int fd
, const char *format
, ...)
115 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
116 _GL_ARG_NONNULL ((2)));
117 _GL_CXXALIAS_RPL (dprintf
, int, (int fd
, const char *format
, ...));
120 _GL_FUNCDECL_SYS (dprintf
, int, (int fd
, const char *format
, ...)
121 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
122 _GL_ARG_NONNULL ((2)));
124 _GL_CXXALIAS_SYS (dprintf
, int, (int fd
, const char *format
, ...));
126 _GL_CXXALIASWARN (dprintf
);
127 #elif defined GNULIB_POSIXCHECK
129 # if HAVE_RAW_DECL_DPRINTF
130 _GL_WARN_ON_USE (dprintf
, "dprintf is unportable - "
131 "use gnulib module dprintf for portability");
136 /* Close STREAM and its underlying file descriptor. */
137 # if @REPLACE_FCLOSE@
138 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
139 # define fclose rpl_fclose
141 _GL_FUNCDECL_RPL (fclose
, int, (FILE *stream
) _GL_ARG_NONNULL ((1)));
142 _GL_CXXALIAS_RPL (fclose
, int, (FILE *stream
));
144 _GL_CXXALIAS_SYS (fclose
, int, (FILE *stream
));
146 _GL_CXXALIASWARN (fclose
);
147 #elif defined GNULIB_POSIXCHECK
149 /* Assume fclose is always declared. */
150 _GL_WARN_ON_USE (fclose
, "fclose is not always POSIX compliant - "
151 "use gnulib module fclose for portable POSIX compliance");
155 /* Flush all pending data on STREAM according to POSIX rules. Both
156 output and seekable input streams are supported.
157 Note! LOSS OF DATA can occur if fflush is applied on an input stream
158 that is _not_seekable_ or on an update stream that is _not_seekable_
159 and in which the most recent operation was input. Seekability can
160 be tested with lseek(fileno(fp),0,SEEK_CUR). */
161 # if @REPLACE_FFLUSH@
162 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
163 # define fflush rpl_fflush
165 _GL_FUNCDECL_RPL (fflush
, int, (FILE *gl_stream
));
166 _GL_CXXALIAS_RPL (fflush
, int, (FILE *gl_stream
));
168 _GL_CXXALIAS_SYS (fflush
, int, (FILE *gl_stream
));
170 _GL_CXXALIASWARN (fflush
);
171 #elif defined GNULIB_POSIXCHECK
173 /* Assume fflush is always declared. */
174 _GL_WARN_ON_USE (fflush
, "fflush is not always POSIX compliant - "
175 "use gnulib module fflush for portable POSIX compliance");
178 /* It is very rare that the developer ever has full control of stdin,
179 so any use of gets warrants an unconditional warning. Assume it is
180 always declared, since it is required by C89. */
182 _GL_WARN_ON_USE (gets
, "gets is a security hole - use fgets instead");
186 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
188 # define fopen rpl_fopen
190 _GL_FUNCDECL_RPL (fopen
, FILE *, (const char *filename
, const char *mode
)
191 _GL_ARG_NONNULL ((1, 2)));
192 _GL_CXXALIAS_RPL (fopen
, FILE *, (const char *filename
, const char *mode
));
194 _GL_CXXALIAS_SYS (fopen
, FILE *, (const char *filename
, const char *mode
));
196 _GL_CXXALIASWARN (fopen
);
197 #elif defined GNULIB_POSIXCHECK
199 /* Assume fopen is always declared. */
200 _GL_WARN_ON_USE (fopen
, "fopen on Win32 platforms is not POSIX compatible - "
201 "use gnulib module fopen for portability");
204 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
205 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
206 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
207 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
208 # define fprintf rpl_fprintf
210 # define GNULIB_overrides_fprintf 1
211 # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
212 _GL_FUNCDECL_RPL (fprintf
, int, (FILE *fp
, const char *format
, ...)
213 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
214 _GL_ARG_NONNULL ((1, 2)));
216 _GL_FUNCDECL_RPL (fprintf
, int, (FILE *fp
, const char *format
, ...)
217 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
218 _GL_ARG_NONNULL ((1, 2)));
220 _GL_CXXALIAS_RPL (fprintf
, int, (FILE *fp
, const char *format
, ...));
222 _GL_CXXALIAS_SYS (fprintf
, int, (FILE *fp
, const char *format
, ...));
224 _GL_CXXALIASWARN (fprintf
);
226 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
227 # if !GNULIB_overrides_fprintf
230 /* Assume fprintf is always declared. */
231 _GL_WARN_ON_USE (fprintf
, "fprintf is not always POSIX compliant - "
232 "use gnulib module fprintf-posix for portable "
237 /* Discard all pending buffered I/O data on STREAM.
238 STREAM must not be wide-character oriented.
239 When discarding pending output, the file position is set back to where it
240 was before the write calls. When discarding pending input, the file
241 position is advanced to match the end of the previously read input.
242 Return 0 if successful. Upon error, return -1 and set errno. */
243 # if @REPLACE_FPURGE@
244 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
245 # define fpurge rpl_fpurge
247 _GL_FUNCDECL_RPL (fpurge
, int, (FILE *gl_stream
) _GL_ARG_NONNULL ((1)));
248 _GL_CXXALIAS_RPL (fpurge
, int, (FILE *gl_stream
));
250 # if !@HAVE_DECL_FPURGE@
251 _GL_FUNCDECL_SYS (fpurge
, int, (FILE *gl_stream
) _GL_ARG_NONNULL ((1)));
253 _GL_CXXALIAS_SYS (fpurge
, int, (FILE *gl_stream
));
255 _GL_CXXALIASWARN (fpurge
);
256 #elif defined GNULIB_POSIXCHECK
258 # if HAVE_RAW_DECL_FPURGE
259 _GL_WARN_ON_USE (fpurge
, "fpurge is not always present - "
260 "use gnulib module fpurge for portability");
265 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
266 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
268 # define fputc rpl_fputc
270 _GL_FUNCDECL_RPL (fputc
, int, (int c
, FILE *stream
) _GL_ARG_NONNULL ((2)));
271 _GL_CXXALIAS_RPL (fputc
, int, (int c
, FILE *stream
));
273 _GL_CXXALIAS_SYS (fputc
, int, (int c
, FILE *stream
));
275 _GL_CXXALIASWARN (fputc
);
279 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
280 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
282 # define fputs rpl_fputs
284 _GL_FUNCDECL_RPL (fputs
, int, (const char *string
, FILE *stream
)
285 _GL_ARG_NONNULL ((1, 2)));
286 _GL_CXXALIAS_RPL (fputs
, int, (const char *string
, FILE *stream
));
288 _GL_CXXALIAS_SYS (fputs
, int, (const char *string
, FILE *stream
));
290 _GL_CXXALIASWARN (fputs
);
294 # if @REPLACE_FREOPEN@
295 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
297 # define freopen rpl_freopen
299 _GL_FUNCDECL_RPL (freopen
, FILE *,
300 (const char *filename
, const char *mode
, FILE *stream
)
301 _GL_ARG_NONNULL ((2, 3)));
302 _GL_CXXALIAS_RPL (freopen
, FILE *,
303 (const char *filename
, const char *mode
, FILE *stream
));
305 _GL_CXXALIAS_SYS (freopen
, FILE *,
306 (const char *filename
, const char *mode
, FILE *stream
));
308 _GL_CXXALIASWARN (freopen
);
309 #elif defined GNULIB_POSIXCHECK
311 /* Assume freopen is always declared. */
312 _GL_WARN_ON_USE (freopen
,
313 "freopen on Win32 platforms is not POSIX compatible - "
314 "use gnulib module freopen for portability");
318 /* Set up the following warnings, based on which modules are in use.
319 GNU Coding Standards discourage the use of fseek, since it imposes
320 an arbitrary limitation on some 32-bit hosts. Remember that the
321 fseek module depends on the fseeko module, so we only have three
324 1. The developer is not using either module. Issue a warning under
325 GNULIB_POSIXCHECK for both functions, to remind them that both
326 functions have bugs on some systems. _GL_NO_LARGE_FILES has no
327 impact on this warning.
329 2. The developer is using both modules. They may be unaware of the
330 arbitrary limitations of fseek, so issue a warning under
331 GNULIB_POSIXCHECK. On the other hand, they may be using both
332 modules intentionally, so the developer can define
333 _GL_NO_LARGE_FILES in the compilation units where the use of fseek
334 is safe, to silence the warning.
336 3. The developer is using the fseeko module, but not fseek. Gnulib
337 guarantees that fseek will still work around platform bugs in that
338 case, but we presume that the developer is aware of the pitfalls of
339 fseek and was trying to avoid it, so issue a warning even when
340 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
341 defined to silence the warning in particular compilation units.
342 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
343 fseek gets defined as a macro, it is recommended that the developer
344 uses the fseek module, even if he is not calling the fseek function.
346 Most gnulib clients that perform stream operations should fall into
350 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
351 # define _GL_FSEEK_WARN /* Category 2, above. */
355 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
357 # define fseek rpl_fseek
359 _GL_FUNCDECL_RPL (fseek
, int, (FILE *fp
, long offset
, int whence
)
360 _GL_ARG_NONNULL ((1)));
361 _GL_CXXALIAS_RPL (fseek
, int, (FILE *fp
, long offset
, int whence
));
363 _GL_CXXALIAS_SYS (fseek
, int, (FILE *fp
, long offset
, int whence
));
365 _GL_CXXALIASWARN (fseek
);
369 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
370 # define _GL_FSEEK_WARN /* Category 3, above. */
373 # if @REPLACE_FSEEKO@
374 /* Provide an fseeko function that is aware of a preceding fflush(), and which
376 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
378 # define fseeko rpl_fseeko
380 _GL_FUNCDECL_RPL (fseeko
, int, (FILE *fp
, off_t offset
, int whence
)
381 _GL_ARG_NONNULL ((1)));
382 _GL_CXXALIAS_RPL (fseeko
, int, (FILE *fp
, off_t offset
, int whence
));
384 # if ! @HAVE_DECL_FSEEKO@
385 _GL_FUNCDECL_SYS (fseeko
, int, (FILE *fp
, off_t offset
, int whence
)
386 _GL_ARG_NONNULL ((1)));
388 _GL_CXXALIAS_SYS (fseeko
, int, (FILE *fp
, off_t offset
, int whence
));
390 _GL_CXXALIASWARN (fseeko
);
391 # if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@
392 /* Provide an fseek function that is consistent with fseeko. */
393 /* In order to avoid that fseek gets defined as a macro here, the
394 developer can request the 'fseek' module. */
395 # if !GNULIB_defined_fseek_function
397 # define fseek rpl_fseek
398 static inline int _GL_ARG_NONNULL ((1))
399 rpl_fseek (FILE *fp
, long offset
, int whence
)
401 # if @REPLACE_FSEEKO@
402 return rpl_fseeko (fp
, offset
, whence
);
404 return fseeko (fp
, offset
, whence
);
407 # define GNULIB_defined_fseek_function 1
410 #elif defined GNULIB_POSIXCHECK
411 # define _GL_FSEEK_WARN /* Category 1, above. */
414 # if HAVE_RAW_DECL_FSEEKO
415 _GL_WARN_ON_USE (fseeko
, "fseeko is unportable - "
416 "use gnulib module fseeko for portability");
420 #ifdef _GL_FSEEK_WARN
421 # undef _GL_FSEEK_WARN
422 /* Here, either fseek is undefined (but C89 guarantees that it is
423 declared), or it is defined as rpl_fseek (declared above). */
424 _GL_WARN_ON_USE (fseek
, "fseek cannot handle files larger than 4 GB "
425 "on 32-bit platforms - "
426 "use fseeko function for handling of large files");
430 /* ftell, ftello. See the comments on fseek/fseeko. */
433 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
434 # define _GL_FTELL_WARN /* Category 2, above. */
438 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
440 # define ftell rpl_ftell
442 _GL_FUNCDECL_RPL (ftell
, long, (FILE *fp
) _GL_ARG_NONNULL ((1)));
443 _GL_CXXALIAS_RPL (ftell
, long, (FILE *fp
));
445 _GL_CXXALIAS_SYS (ftell
, long, (FILE *fp
));
447 _GL_CXXALIASWARN (ftell
);
451 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
452 # define _GL_FTELL_WARN /* Category 3, above. */
455 # if @REPLACE_FTELLO@
456 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
458 # define ftello rpl_ftello
460 _GL_FUNCDECL_RPL (ftello
, off_t
, (FILE *fp
) _GL_ARG_NONNULL ((1)));
461 _GL_CXXALIAS_RPL (ftello
, off_t
, (FILE *fp
));
463 # if ! @HAVE_DECL_FTELLO@
464 _GL_FUNCDECL_SYS (ftello
, off_t
, (FILE *fp
) _GL_ARG_NONNULL ((1)));
466 _GL_CXXALIAS_SYS (ftello
, off_t
, (FILE *fp
));
468 _GL_CXXALIASWARN (ftello
);
469 # if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@
470 /* Provide an ftell function that is consistent with ftello. */
471 /* In order to avoid that ftell gets defined as a macro here, the
472 developer can request the 'ftell' module. */
473 # if !GNULIB_defined_ftell_function
475 # define ftell rpl_ftell
476 static inline long _GL_ARG_NONNULL ((1))
479 # if @REPLACE_FTELLO@
480 return rpl_ftello (f
);
485 # define GNULIB_defined_ftell_function 1
488 #elif defined GNULIB_POSIXCHECK
489 # define _GL_FTELL_WARN /* Category 1, above. */
492 # if HAVE_RAW_DECL_FTELLO
493 _GL_WARN_ON_USE (ftello
, "ftello is unportable - "
494 "use gnulib module ftello for portability");
498 #ifdef _GL_FTELL_WARN
499 # undef _GL_FTELL_WARN
500 /* Here, either ftell is undefined (but C89 guarantees that it is
501 declared), or it is defined as rpl_ftell (declared above). */
502 _GL_WARN_ON_USE (ftell
, "ftell cannot handle files larger than 4 GB "
503 "on 32-bit platforms - "
504 "use ftello function for handling of large files");
509 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
510 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
512 # define fwrite rpl_fwrite
514 _GL_FUNCDECL_RPL (fwrite
, size_t,
515 (const void *ptr
, size_t s
, size_t n
, FILE *stream
)
516 _GL_ARG_NONNULL ((1, 4)));
517 _GL_CXXALIAS_RPL (fwrite
, size_t,
518 (const void *ptr
, size_t s
, size_t n
, FILE *stream
));
520 _GL_CXXALIAS_SYS (fwrite
, size_t,
521 (const void *ptr
, size_t s
, size_t n
, FILE *stream
));
523 /* Work around glibc bug 11959
524 <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
525 which sometimes causes an unwanted diagnostic for fwrite calls.
526 This affects only function declaration attributes, so it's not
528 # if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL
529 static inline size_t _GL_ARG_NONNULL ((1, 4))
530 rpl_fwrite (const void *ptr
, size_t s
, size_t n
, FILE *stream
)
532 size_t r
= fwrite (ptr
, s
, n
, stream
);
537 # define fwrite rpl_fwrite
540 _GL_CXXALIASWARN (fwrite
);
543 #if @GNULIB_GETDELIM@
544 /* Read input, up to (and including) the next occurrence of DELIMITER, from
545 STREAM, store it in *LINEPTR (and NUL-terminate it).
546 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
547 bytes of space. It is realloc'd as necessary.
548 Return the number of bytes read and stored at *LINEPTR (not including the
549 NUL terminator), or -1 on error or EOF. */
550 # if @REPLACE_GETDELIM@
551 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
553 # define getdelim rpl_getdelim
555 _GL_FUNCDECL_RPL (getdelim
, ssize_t
,
556 (char **lineptr
, size_t *linesize
, int delimiter
,
558 _GL_ARG_NONNULL ((1, 2, 4)));
559 _GL_CXXALIAS_RPL (getdelim
, ssize_t
,
560 (char **lineptr
, size_t *linesize
, int delimiter
,
563 # if !@HAVE_DECL_GETDELIM@
564 _GL_FUNCDECL_SYS (getdelim
, ssize_t
,
565 (char **lineptr
, size_t *linesize
, int delimiter
,
567 _GL_ARG_NONNULL ((1, 2, 4)));
569 _GL_CXXALIAS_SYS (getdelim
, ssize_t
,
570 (char **lineptr
, size_t *linesize
, int delimiter
,
573 _GL_CXXALIASWARN (getdelim
);
574 #elif defined GNULIB_POSIXCHECK
576 # if HAVE_RAW_DECL_GETDELIM
577 _GL_WARN_ON_USE (getdelim
, "getdelim is unportable - "
578 "use gnulib module getdelim for portability");
583 /* Read a line, up to (and including) the next newline, from STREAM, store it
584 in *LINEPTR (and NUL-terminate it).
585 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
586 bytes of space. It is realloc'd as necessary.
587 Return the number of bytes read and stored at *LINEPTR (not including the
588 NUL terminator), or -1 on error or EOF. */
589 # if @REPLACE_GETLINE@
590 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
592 # define getline rpl_getline
594 _GL_FUNCDECL_RPL (getline
, ssize_t
,
595 (char **lineptr
, size_t *linesize
, FILE *stream
)
596 _GL_ARG_NONNULL ((1, 2, 3)));
597 _GL_CXXALIAS_RPL (getline
, ssize_t
,
598 (char **lineptr
, size_t *linesize
, FILE *stream
));
600 # if !@HAVE_DECL_GETLINE@
601 _GL_FUNCDECL_SYS (getline
, ssize_t
,
602 (char **lineptr
, size_t *linesize
, FILE *stream
)
603 _GL_ARG_NONNULL ((1, 2, 3)));
605 _GL_CXXALIAS_SYS (getline
, ssize_t
,
606 (char **lineptr
, size_t *linesize
, FILE *stream
));
608 # if @HAVE_DECL_GETLINE@
609 _GL_CXXALIASWARN (getline
);
611 #elif defined GNULIB_POSIXCHECK
613 # if HAVE_RAW_DECL_GETLINE
614 _GL_WARN_ON_USE (getline
, "getline is unportable - "
615 "use gnulib module getline for portability");
619 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
621 /* Grow an obstack with formatted output. Return the number of
622 bytes added to OBS. No trailing nul byte is added, and the
623 object should be closed with obstack_finish before use. Upon
624 memory allocation error, call obstack_alloc_failed_handler. Upon
625 other error, return -1. */
626 # if @REPLACE_OBSTACK_PRINTF@
627 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
628 # define obstack_printf rpl_obstack_printf
630 _GL_FUNCDECL_RPL (obstack_printf
, int,
631 (struct obstack
*obs
, const char *format
, ...)
632 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
633 _GL_ARG_NONNULL ((1, 2)));
634 _GL_CXXALIAS_RPL (obstack_printf
, int,
635 (struct obstack
*obs
, const char *format
, ...));
637 # if !@HAVE_DECL_OBSTACK_PRINTF@
638 _GL_FUNCDECL_SYS (obstack_printf
, int,
639 (struct obstack
*obs
, const char *format
, ...)
640 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
641 _GL_ARG_NONNULL ((1, 2)));
643 _GL_CXXALIAS_SYS (obstack_printf
, int,
644 (struct obstack
*obs
, const char *format
, ...));
646 _GL_CXXALIASWARN (obstack_printf
);
647 # if @REPLACE_OBSTACK_PRINTF@
648 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
649 # define obstack_vprintf rpl_obstack_vprintf
651 _GL_FUNCDECL_RPL (obstack_vprintf
, int,
652 (struct obstack
*obs
, const char *format
, va_list args
)
653 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
654 _GL_ARG_NONNULL ((1, 2)));
655 _GL_CXXALIAS_RPL (obstack_vprintf
, int,
656 (struct obstack
*obs
, const char *format
, va_list args
));
658 # if !@HAVE_DECL_OBSTACK_PRINTF@
659 _GL_FUNCDECL_SYS (obstack_vprintf
, int,
660 (struct obstack
*obs
, const char *format
, va_list args
)
661 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
662 _GL_ARG_NONNULL ((1, 2)));
664 _GL_CXXALIAS_SYS (obstack_vprintf
, int,
665 (struct obstack
*obs
, const char *format
, va_list args
));
667 _GL_CXXALIASWARN (obstack_vprintf
);
671 /* Print a message to standard error, describing the value of ERRNO,
672 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
673 and terminated with a newline. */
674 # if @REPLACE_PERROR@
675 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
676 # define perror rpl_perror
678 _GL_FUNCDECL_RPL (perror
, void, (const char *string
));
679 _GL_CXXALIAS_RPL (perror
, void, (const char *string
));
681 _GL_CXXALIAS_SYS (perror
, void, (const char *string
));
683 _GL_CXXALIASWARN (perror
);
684 #elif defined GNULIB_POSIXCHECK
686 /* Assume perror is always declared. */
687 _GL_WARN_ON_USE (perror
, "perror is not always POSIX compliant - "
688 "use gnulib module perror for portability");
693 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
695 # define popen rpl_popen
697 _GL_FUNCDECL_RPL (popen
, FILE *, (const char *cmd
, const char *mode
)
698 _GL_ARG_NONNULL ((1, 2)));
699 _GL_CXXALIAS_RPL (popen
, FILE *, (const char *cmd
, const char *mode
));
701 _GL_CXXALIAS_SYS (popen
, FILE *, (const char *cmd
, const char *mode
));
703 _GL_CXXALIASWARN (popen
);
704 #elif defined GNULIB_POSIXCHECK
706 # if HAVE_RAW_DECL_POPEN
707 _GL_WARN_ON_USE (popen
, "popen is buggy on some platforms - "
708 "use gnulib module popen or pipe for more portability");
712 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
713 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
714 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
715 # if defined __GNUC__
716 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
717 /* Don't break __attribute__((format(printf,M,N))). */
718 # define printf __printf__
720 # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
721 _GL_FUNCDECL_RPL_1 (__printf__
, int,
722 (const char *format
, ...)
723 __asm__ (@ASM_SYMBOL_PREFIX@
724 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf
))
725 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
726 _GL_ARG_NONNULL ((1)));
728 _GL_FUNCDECL_RPL_1 (__printf__
, int,
729 (const char *format
, ...)
730 __asm__ (@ASM_SYMBOL_PREFIX@
731 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf
))
732 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
733 _GL_ARG_NONNULL ((1)));
735 _GL_CXXALIAS_RPL_1 (printf
, __printf__
, int, (const char *format
, ...));
737 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
738 # define printf rpl_printf
740 _GL_FUNCDECL_RPL (printf
, int,
741 (const char *format
, ...)
742 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
743 _GL_ARG_NONNULL ((1)));
744 _GL_CXXALIAS_RPL (printf
, int, (const char *format
, ...));
746 # define GNULIB_overrides_printf 1
748 _GL_CXXALIAS_SYS (printf
, int, (const char *format
, ...));
750 _GL_CXXALIASWARN (printf
);
752 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
753 # if !GNULIB_overrides_printf
756 /* Assume printf is always declared. */
757 _GL_WARN_ON_USE (printf
, "printf is not always POSIX compliant - "
758 "use gnulib module printf-posix for portable "
763 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
764 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
766 # define putc rpl_fputc
768 _GL_FUNCDECL_RPL (fputc
, int, (int c
, FILE *stream
) _GL_ARG_NONNULL ((2)));
769 _GL_CXXALIAS_RPL_1 (putc
, rpl_fputc
, int, (int c
, FILE *stream
));
771 _GL_CXXALIAS_SYS (putc
, int, (int c
, FILE *stream
));
773 _GL_CXXALIASWARN (putc
);
777 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
778 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
780 # define putchar rpl_putchar
782 _GL_FUNCDECL_RPL (putchar
, int, (int c
));
783 _GL_CXXALIAS_RPL (putchar
, int, (int c
));
785 _GL_CXXALIAS_SYS (putchar
, int, (int c
));
787 _GL_CXXALIASWARN (putchar
);
791 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
792 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
794 # define puts rpl_puts
796 _GL_FUNCDECL_RPL (puts
, int, (const char *string
) _GL_ARG_NONNULL ((1)));
797 _GL_CXXALIAS_RPL (puts
, int, (const char *string
));
799 _GL_CXXALIAS_SYS (puts
, int, (const char *string
));
801 _GL_CXXALIASWARN (puts
);
805 # if @REPLACE_REMOVE@
806 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
808 # define remove rpl_remove
810 _GL_FUNCDECL_RPL (remove
, int, (const char *name
) _GL_ARG_NONNULL ((1)));
811 _GL_CXXALIAS_RPL (remove
, int, (const char *name
));
813 _GL_CXXALIAS_SYS (remove
, int, (const char *name
));
815 _GL_CXXALIASWARN (remove
);
816 #elif defined GNULIB_POSIXCHECK
818 /* Assume remove is always declared. */
819 _GL_WARN_ON_USE (remove
, "remove cannot handle directories on some platforms - "
820 "use gnulib module remove for more portability");
824 # if @REPLACE_RENAME@
825 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
827 # define rename rpl_rename
829 _GL_FUNCDECL_RPL (rename
, int,
830 (const char *old_filename
, const char *new_filename
)
831 _GL_ARG_NONNULL ((1, 2)));
832 _GL_CXXALIAS_RPL (rename
, int,
833 (const char *old_filename
, const char *new_filename
));
835 _GL_CXXALIAS_SYS (rename
, int,
836 (const char *old_filename
, const char *new_filename
));
838 _GL_CXXALIASWARN (rename
);
839 #elif defined GNULIB_POSIXCHECK
841 /* Assume rename is always declared. */
842 _GL_WARN_ON_USE (rename
, "rename is buggy on some platforms - "
843 "use gnulib module rename for more portability");
846 #if @GNULIB_RENAMEAT@
847 # if @REPLACE_RENAMEAT@
848 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
850 # define renameat rpl_renameat
852 _GL_FUNCDECL_RPL (renameat
, int,
853 (int fd1
, char const *file1
, int fd2
, char const *file2
)
854 _GL_ARG_NONNULL ((2, 4)));
855 _GL_CXXALIAS_RPL (renameat
, int,
856 (int fd1
, char const *file1
, int fd2
, char const *file2
));
858 # if !@HAVE_RENAMEAT@
859 _GL_FUNCDECL_SYS (renameat
, int,
860 (int fd1
, char const *file1
, int fd2
, char const *file2
)
861 _GL_ARG_NONNULL ((2, 4)));
863 _GL_CXXALIAS_SYS (renameat
, int,
864 (int fd1
, char const *file1
, int fd2
, char const *file2
));
866 _GL_CXXALIASWARN (renameat
);
867 #elif defined GNULIB_POSIXCHECK
869 # if HAVE_RAW_DECL_RENAMEAT
870 _GL_WARN_ON_USE (renameat
, "renameat is not portable - "
871 "use gnulib module renameat for portability");
875 #if @GNULIB_SNPRINTF@
876 # if @REPLACE_SNPRINTF@
877 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
878 # define snprintf rpl_snprintf
880 _GL_FUNCDECL_RPL (snprintf
, int,
881 (char *str
, size_t size
, const char *format
, ...)
882 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
883 _GL_ARG_NONNULL ((3)));
884 _GL_CXXALIAS_RPL (snprintf
, int,
885 (char *str
, size_t size
, const char *format
, ...));
887 # if !@HAVE_DECL_SNPRINTF@
888 _GL_FUNCDECL_SYS (snprintf
, int,
889 (char *str
, size_t size
, const char *format
, ...)
890 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
891 _GL_ARG_NONNULL ((3)));
893 _GL_CXXALIAS_SYS (snprintf
, int,
894 (char *str
, size_t size
, const char *format
, ...));
896 _GL_CXXALIASWARN (snprintf
);
897 #elif defined GNULIB_POSIXCHECK
899 # if HAVE_RAW_DECL_SNPRINTF
900 _GL_WARN_ON_USE (snprintf
, "snprintf is unportable - "
901 "use gnulib module snprintf for portability");
905 /* Some people would argue that sprintf should be handled like gets
906 (for example, OpenBSD issues a link warning for both functions),
907 since both can cause security holes due to buffer overruns.
908 However, we believe that sprintf can be used safely, and is more
909 efficient than snprintf in those safe cases; and as proof of our
910 belief, we use sprintf in several gnulib modules. So this header
911 intentionally avoids adding a warning to sprintf except when
912 GNULIB_POSIXCHECK is defined. */
914 #if @GNULIB_SPRINTF_POSIX@
915 # if @REPLACE_SPRINTF@
916 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
917 # define sprintf rpl_sprintf
919 _GL_FUNCDECL_RPL (sprintf
, int, (char *str
, const char *format
, ...)
920 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
921 _GL_ARG_NONNULL ((1, 2)));
922 _GL_CXXALIAS_RPL (sprintf
, int, (char *str
, const char *format
, ...));
924 _GL_CXXALIAS_SYS (sprintf
, int, (char *str
, const char *format
, ...));
926 _GL_CXXALIASWARN (sprintf
);
927 #elif defined GNULIB_POSIXCHECK
929 /* Assume sprintf is always declared. */
930 _GL_WARN_ON_USE (sprintf
, "sprintf is not always POSIX compliant - "
931 "use gnulib module sprintf-posix for portable "
936 # if @REPLACE_TMPFILE@
937 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
938 # define tmpfile rpl_tmpfile
940 _GL_FUNCDECL_RPL (tmpfile
, FILE *, (void));
941 _GL_CXXALIAS_RPL (tmpfile
, FILE *, (void));
943 _GL_CXXALIAS_SYS (tmpfile
, FILE *, (void));
945 _GL_CXXALIASWARN (tmpfile
);
946 #elif defined GNULIB_POSIXCHECK
948 # if HAVE_RAW_DECL_TMPFILE
949 _GL_WARN_ON_USE (tmpfile
, "tmpfile is not usable on mingw - "
950 "use gnulib module tmpfile for portability");
954 #if @GNULIB_VASPRINTF@
955 /* Write formatted output to a string dynamically allocated with malloc().
956 If the memory allocation succeeds, store the address of the string in
957 *RESULT and return the number of resulting bytes, excluding the trailing
958 NUL. Upon memory allocation error, or some other error, return -1. */
959 # if @REPLACE_VASPRINTF@
960 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
961 # define asprintf rpl_asprintf
963 _GL_FUNCDECL_RPL (asprintf
, int,
964 (char **result
, const char *format
, ...)
965 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
966 _GL_ARG_NONNULL ((1, 2)));
967 _GL_CXXALIAS_RPL (asprintf
, int,
968 (char **result
, const char *format
, ...));
970 # if !@HAVE_VASPRINTF@
971 _GL_FUNCDECL_SYS (asprintf
, int,
972 (char **result
, const char *format
, ...)
973 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
974 _GL_ARG_NONNULL ((1, 2)));
976 _GL_CXXALIAS_SYS (asprintf
, int,
977 (char **result
, const char *format
, ...));
979 _GL_CXXALIASWARN (asprintf
);
980 # if @REPLACE_VASPRINTF@
981 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
982 # define vasprintf rpl_vasprintf
984 _GL_FUNCDECL_RPL (vasprintf
, int,
985 (char **result
, const char *format
, va_list args
)
986 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
987 _GL_ARG_NONNULL ((1, 2)));
988 _GL_CXXALIAS_RPL (vasprintf
, int,
989 (char **result
, const char *format
, va_list args
));
991 # if !@HAVE_VASPRINTF@
992 _GL_FUNCDECL_SYS (vasprintf
, int,
993 (char **result
, const char *format
, va_list args
)
994 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
995 _GL_ARG_NONNULL ((1, 2)));
997 _GL_CXXALIAS_SYS (vasprintf
, int,
998 (char **result
, const char *format
, va_list args
));
1000 _GL_CXXALIASWARN (vasprintf
);
1003 #if @GNULIB_VDPRINTF@
1004 # if @REPLACE_VDPRINTF@
1005 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1006 # define vdprintf rpl_vdprintf
1008 _GL_FUNCDECL_RPL (vdprintf
, int, (int fd
, const char *format
, va_list args
)
1009 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1010 _GL_ARG_NONNULL ((2)));
1011 _GL_CXXALIAS_RPL (vdprintf
, int, (int fd
, const char *format
, va_list args
));
1013 # if !@HAVE_VDPRINTF@
1014 _GL_FUNCDECL_SYS (vdprintf
, int, (int fd
, const char *format
, va_list args
)
1015 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1016 _GL_ARG_NONNULL ((2)));
1018 /* Need to cast, because on Solaris, the third parameter will likely be
1020 _GL_CXXALIAS_SYS_CAST (vdprintf
, int,
1021 (int fd
, const char *format
, va_list args
));
1023 _GL_CXXALIASWARN (vdprintf
);
1024 #elif defined GNULIB_POSIXCHECK
1026 # if HAVE_RAW_DECL_VDPRINTF
1027 _GL_WARN_ON_USE (vdprintf
, "vdprintf is unportable - "
1028 "use gnulib module vdprintf for portability");
1032 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1033 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1034 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
1035 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1036 # define vfprintf rpl_vfprintf
1038 # define GNULIB_overrides_vfprintf 1
1039 # if @GNULIB_VFPRINTF_POSIX@
1040 _GL_FUNCDECL_RPL (vfprintf
, int, (FILE *fp
, const char *format
, va_list args
)
1041 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1042 _GL_ARG_NONNULL ((1, 2)));
1044 _GL_FUNCDECL_RPL (vfprintf
, int, (FILE *fp
, const char *format
, va_list args
)
1045 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1046 _GL_ARG_NONNULL ((1, 2)));
1048 _GL_CXXALIAS_RPL (vfprintf
, int, (FILE *fp
, const char *format
, va_list args
));
1050 /* Need to cast, because on Solaris, the third parameter is
1052 and GCC's fixincludes did not change this to __gnuc_va_list. */
1053 _GL_CXXALIAS_SYS_CAST (vfprintf
, int,
1054 (FILE *fp
, const char *format
, va_list args
));
1056 _GL_CXXALIASWARN (vfprintf
);
1058 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1059 # if !GNULIB_overrides_vfprintf
1062 /* Assume vfprintf is always declared. */
1063 _GL_WARN_ON_USE (vfprintf
, "vfprintf is not always POSIX compliant - "
1064 "use gnulib module vfprintf-posix for portable "
1065 "POSIX compliance");
1068 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1069 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1070 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
1071 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1072 # define vprintf rpl_vprintf
1074 # define GNULIB_overrides_vprintf 1
1075 # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1076 _GL_FUNCDECL_RPL (vprintf
, int, (const char *format
, va_list args
)
1077 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
1078 _GL_ARG_NONNULL ((1)));
1080 _GL_FUNCDECL_RPL (vprintf
, int, (const char *format
, va_list args
)
1081 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1082 _GL_ARG_NONNULL ((1)));
1084 _GL_CXXALIAS_RPL (vprintf
, int, (const char *format
, va_list args
));
1086 /* Need to cast, because on Solaris, the second parameter is
1088 and GCC's fixincludes did not change this to __gnuc_va_list. */
1089 _GL_CXXALIAS_SYS_CAST (vprintf
, int, (const char *format
, va_list args
));
1091 _GL_CXXALIASWARN (vprintf
);
1093 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1094 # if !GNULIB_overrides_vprintf
1097 /* Assume vprintf is always declared. */
1098 _GL_WARN_ON_USE (vprintf
, "vprintf is not always POSIX compliant - "
1099 "use gnulib module vprintf-posix for portable "
1100 "POSIX compliance");
1103 #if @GNULIB_VSNPRINTF@
1104 # if @REPLACE_VSNPRINTF@
1105 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1106 # define vsnprintf rpl_vsnprintf
1108 _GL_FUNCDECL_RPL (vsnprintf
, int,
1109 (char *str
, size_t size
, const char *format
, va_list args
)
1110 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1111 _GL_ARG_NONNULL ((3)));
1112 _GL_CXXALIAS_RPL (vsnprintf
, int,
1113 (char *str
, size_t size
, const char *format
, va_list args
));
1115 # if !@HAVE_DECL_VSNPRINTF@
1116 _GL_FUNCDECL_SYS (vsnprintf
, int,
1117 (char *str
, size_t size
, const char *format
, va_list args
)
1118 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1119 _GL_ARG_NONNULL ((3)));
1121 _GL_CXXALIAS_SYS (vsnprintf
, int,
1122 (char *str
, size_t size
, const char *format
, va_list args
));
1124 _GL_CXXALIASWARN (vsnprintf
);
1125 #elif defined GNULIB_POSIXCHECK
1127 # if HAVE_RAW_DECL_VSNPRINTF
1128 _GL_WARN_ON_USE (vsnprintf
, "vsnprintf is unportable - "
1129 "use gnulib module vsnprintf for portability");
1133 #if @GNULIB_VSPRINTF_POSIX@
1134 # if @REPLACE_VSPRINTF@
1135 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1136 # define vsprintf rpl_vsprintf
1138 _GL_FUNCDECL_RPL (vsprintf
, int,
1139 (char *str
, const char *format
, va_list args
)
1140 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1141 _GL_ARG_NONNULL ((1, 2)));
1142 _GL_CXXALIAS_RPL (vsprintf
, int,
1143 (char *str
, const char *format
, va_list args
));
1145 /* Need to cast, because on Solaris, the third parameter is
1147 and GCC's fixincludes did not change this to __gnuc_va_list. */
1148 _GL_CXXALIAS_SYS_CAST (vsprintf
, int,
1149 (char *str
, const char *format
, va_list args
));
1151 _GL_CXXALIASWARN (vsprintf
);
1152 #elif defined GNULIB_POSIXCHECK
1154 /* Assume vsprintf is always declared. */
1155 _GL_WARN_ON_USE (vsprintf
, "vsprintf is not always POSIX compliant - "
1156 "use gnulib module vsprintf-posix for portable "
1157 "POSIX compliance");
1161 #endif /* _GL_STDIO_H */
1162 #endif /* _GL_STDIO_H */