Import Gnulib's `git-version-gen' module.
[bpt/guile.git] / lib / stdio.in.h
CommitLineData
c4b681fd
LC
1/* A GNU-like <stdio.h>.
2
61cd9dc9 3 Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
c4b681fd
LC
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser 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. */
18
19#if __GNUC__ >= 3
20@PRAGMA_SYSTEM_HEADER@
21#endif
22
23#if defined __need_FILE || defined __need___FILE
24/* Special invocation convention inside glibc header files. */
25
26#@INCLUDE_NEXT@ @NEXT_STDIO_H@
27
28#else
29/* Normal invocation convention. */
30
31#ifndef _GL_STDIO_H
32
33/* The include_next requires a split double-inclusion guard. */
34#@INCLUDE_NEXT@ @NEXT_STDIO_H@
35
36#ifndef _GL_STDIO_H
37#define _GL_STDIO_H
38
61cd9dc9 39/* Get va_list. Needed on many systems, including glibc 2.8. */
c4b681fd 40#include <stdarg.h>
61cd9dc9 41
c4b681fd
LC
42#include <stddef.h>
43
61cd9dc9
LC
44/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8. */
45#include <sys/types.h>
c4b681fd
LC
46
47#ifndef __attribute__
61cd9dc9
LC
48/* The __attribute__ feature is available in gcc versions 2.5 and later.
49 The __-protected variants of the attributes 'format' and 'printf' are
50 accepted by gcc versions 2.6.4 (effectively 2.7) and later.
51 We enable __attribute__ only if these are supported too, because
52 gnulib and libintl do '#define printf __printf__' when they override
53 the 'printf' function. */
c4b681fd 54# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
61cd9dc9 55# define __attribute__(Spec) /* empty */
c4b681fd
LC
56# endif
57#endif
58
59
f4c79b3c
LC
60/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
61
1cd4fffc
LC
62/* The definition of _GL_ARG_NONNULL is copied here. */
63
61cd9dc9
LC
64/* The definition of _GL_WARN_ON_USE is copied here. */
65
a927b6c1
LC
66/* Macros for stringification. */
67#define _GL_STDIO_STRINGIZE(token) #token
68#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
69
c4b681fd 70
c4b681fd
LC
71#if @GNULIB_DPRINTF@
72# if @REPLACE_DPRINTF@
f4c79b3c
LC
73# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
74# define dprintf rpl_dprintf
75# endif
76_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
77 __attribute__ ((__format__ (__printf__, 2, 3)))
78 _GL_ARG_NONNULL ((2)));
79_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
80# else
81# if !@HAVE_DPRINTF@
82_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
83 __attribute__ ((__format__ (__printf__, 2, 3)))
84 _GL_ARG_NONNULL ((2)));
85# endif
86_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
c4b681fd 87# endif
f4c79b3c 88_GL_CXXALIASWARN (dprintf);
c4b681fd
LC
89#elif defined GNULIB_POSIXCHECK
90# undef dprintf
61cd9dc9
LC
91# if HAVE_RAW_DECL_DPRINTF
92_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
93 "use gnulib module dprintf for portability");
94# endif
c4b681fd
LC
95#endif
96
8912421c 97#if @GNULIB_FCLOSE@
f4c79b3c 98/* Close STREAM and its underlying file descriptor. */
8912421c 99# if @REPLACE_FCLOSE@
f4c79b3c
LC
100# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
101# define fclose rpl_fclose
102# endif
103_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
104_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
105# else
106_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
c4b681fd 107# endif
f4c79b3c 108_GL_CXXALIASWARN (fclose);
c4b681fd 109#elif defined GNULIB_POSIXCHECK
8912421c 110# undef fclose
61cd9dc9
LC
111/* Assume fclose is always declared. */
112_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
113 "use gnulib module fclose for portable POSIX compliance");
c4b681fd
LC
114#endif
115
8912421c 116#if @GNULIB_FFLUSH@
f4c79b3c
LC
117/* Flush all pending data on STREAM according to POSIX rules. Both
118 output and seekable input streams are supported.
119 Note! LOSS OF DATA can occur if fflush is applied on an input stream
120 that is _not_seekable_ or on an update stream that is _not_seekable_
121 and in which the most recent operation was input. Seekability can
122 be tested with lseek(fileno(fp),0,SEEK_CUR). */
8912421c 123# if @REPLACE_FFLUSH@
f4c79b3c
LC
124# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
125# define fflush rpl_fflush
126# endif
127_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
128_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
129# else
130_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
c4b681fd 131# endif
f4c79b3c 132_GL_CXXALIASWARN (fflush);
8912421c
LC
133#elif defined GNULIB_POSIXCHECK
134# undef fflush
61cd9dc9
LC
135/* Assume fflush is always declared. */
136_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
137 "use gnulib module fflush for portable POSIX compliance");
c4b681fd
LC
138#endif
139
61cd9dc9
LC
140/* It is very rare that the developer ever has full control of stdin,
141 so any use of gets warrants an unconditional warning. Assume it is
142 always declared, since it is required by C89. */
143#undef gets
144_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
145
c4b681fd
LC
146#if @GNULIB_FOPEN@
147# if @REPLACE_FOPEN@
f4c79b3c
LC
148# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
149# undef fopen
150# define fopen rpl_fopen
151# endif
152_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
153 _GL_ARG_NONNULL ((1, 2)));
154_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
155# else
156_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
c4b681fd 157# endif
f4c79b3c 158_GL_CXXALIASWARN (fopen);
c4b681fd
LC
159#elif defined GNULIB_POSIXCHECK
160# undef fopen
61cd9dc9
LC
161/* Assume fopen is always declared. */
162_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
163 "use gnulib module fopen for portability");
c4b681fd
LC
164#endif
165
f4c79b3c
LC
166#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
167# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
168 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
169# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
170# define fprintf rpl_fprintf
171# endif
172# define GNULIB_overrides_fprintf 1
173_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
174 __attribute__ ((__format__ (__printf__, 2, 3)))
175 _GL_ARG_NONNULL ((1, 2)));
176_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
177# else
178_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
179# endif
180_GL_CXXALIASWARN (fprintf);
181#endif
182#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
183# if !GNULIB_overrides_fprintf
184# undef fprintf
8912421c 185# endif
61cd9dc9
LC
186/* Assume fprintf is always declared. */
187_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
188 "use gnulib module fprintf-posix for portable "
189 "POSIX compliance");
8912421c
LC
190#endif
191
192#if @GNULIB_FPURGE@
f4c79b3c
LC
193/* Discard all pending buffered I/O data on STREAM.
194 STREAM must not be wide-character oriented.
195 When discarding pending output, the file position is set back to where it
196 was before the write calls. When discarding pending input, the file
197 position is advanced to match the end of the previously read input.
198 Return 0 if successful. Upon error, return -1 and set errno. */
8912421c 199# if @REPLACE_FPURGE@
f4c79b3c
LC
200# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
201# define fpurge rpl_fpurge
202# endif
203_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
204_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
205# else
206# if !@HAVE_DECL_FPURGE@
207_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
208# endif
209_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
8912421c 210# endif
f4c79b3c 211_GL_CXXALIASWARN (fpurge);
8912421c
LC
212#elif defined GNULIB_POSIXCHECK
213# undef fpurge
61cd9dc9
LC
214# if HAVE_RAW_DECL_FPURGE
215_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
216 "use gnulib module fpurge for portability");
217# endif
8912421c
LC
218#endif
219
f4c79b3c
LC
220#if @GNULIB_FPUTC@
221# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
222# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
223# undef fputc
224# define fputc rpl_fputc
225# endif
226_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
227_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
228# else
229_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
230# endif
231_GL_CXXALIASWARN (fputc);
8912421c
LC
232#endif
233
f4c79b3c
LC
234#if @GNULIB_FPUTS@
235# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
236# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
237# undef fputs
238# define fputs rpl_fputs
239# endif
240_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
241 _GL_ARG_NONNULL ((1, 2)));
242_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
243# else
244_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
245# endif
246_GL_CXXALIASWARN (fputs);
8912421c
LC
247#endif
248
c4b681fd
LC
249#if @GNULIB_FREOPEN@
250# if @REPLACE_FREOPEN@
f4c79b3c
LC
251# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
252# undef freopen
253# define freopen rpl_freopen
254# endif
255_GL_FUNCDECL_RPL (freopen, FILE *,
256 (const char *filename, const char *mode, FILE *stream)
257 _GL_ARG_NONNULL ((2, 3)));
258_GL_CXXALIAS_RPL (freopen, FILE *,
259 (const char *filename, const char *mode, FILE *stream));
260# else
261_GL_CXXALIAS_SYS (freopen, FILE *,
262 (const char *filename, const char *mode, FILE *stream));
263# endif
264_GL_CXXALIASWARN (freopen);
c4b681fd
LC
265#elif defined GNULIB_POSIXCHECK
266# undef freopen
61cd9dc9
LC
267/* Assume freopen is always declared. */
268_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
269 "use gnulib module freopen for portability");
270#endif
271
f4c79b3c 272
61cd9dc9
LC
273/* Set up the following warnings, based on which modules are in use.
274 GNU Coding Standards discourage the use of fseek, since it imposes
275 an arbitrary limitation on some 32-bit hosts. Remember that the
276 fseek module depends on the fseeko module, so we only have three
277 cases to consider:
278
279 1. The developer is not using either module. Issue a warning under
280 GNULIB_POSIXCHECK for both functions, to remind them that both
281 functions have bugs on some systems. _GL_NO_LARGE_FILES has no
282 impact on this warning.
283
284 2. The developer is using both modules. They may be unaware of the
285 arbitrary limitations of fseek, so issue a warning under
286 GNULIB_POSIXCHECK. On the other hand, they may be using both
287 modules intentionally, so the developer can define
288 _GL_NO_LARGE_FILES in the compilation units where the use of fseek
289 is safe, to silence the warning.
290
291 3. The developer is using the fseeko module, but not fseek. Gnulib
292 guarantees that fseek will still work around platform bugs in that
293 case, but we presume that the developer is aware of the pitfalls of
294 fseek and was trying to avoid it, so issue a warning even when
295 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
296 defined to silence the warning in particular compilation units.
f4c79b3c
LC
297 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
298 fseek gets defined as a macro, it is recommended that the developer
299 uses the fseek module, even if he is not calling the fseek function.
61cd9dc9
LC
300
301 Most gnulib clients that perform stream operations should fall into
f4c79b3c 302 category 3. */
61cd9dc9
LC
303
304#if @GNULIB_FSEEK@
305# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
306# define _GL_FSEEK_WARN /* Category 2, above. */
307# undef fseek
308# endif
309# if @REPLACE_FSEEK@
f4c79b3c
LC
310# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
311# undef fseek
312# define fseek rpl_fseek
313# endif
314_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
315 _GL_ARG_NONNULL ((1)));
316_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
317# else
318_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
c4b681fd 319# endif
f4c79b3c 320_GL_CXXALIASWARN (fseek);
c4b681fd
LC
321#endif
322
8912421c 323#if @GNULIB_FSEEKO@
61cd9dc9
LC
324# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
325# define _GL_FSEEK_WARN /* Category 3, above. */
326# undef fseek
327# endif
8912421c 328# if @REPLACE_FSEEKO@
a927b6c1
LC
329/* Provide an fseeko function that is aware of a preceding fflush(), and which
330 detects pipes. */
f4c79b3c
LC
331# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
332# undef fseeko
333# define fseeko rpl_fseeko
334# endif
335_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
336 _GL_ARG_NONNULL ((1)));
a927b6c1
LC
337_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
338# else
339# if ! @HAVE_FSEEKO@
340_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
341 _GL_ARG_NONNULL ((1)));
342# endif
343_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
344# endif
345_GL_CXXALIASWARN (fseeko);
346# if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@
347 /* Provide an fseek function that is consistent with fseeko. */
348 /* In order to avoid that fseek gets defined as a macro here, the
349 developer can request the 'fseek' module. */
350# undef fseek
351# define fseek rpl_fseek
61cd9dc9
LC
352static inline int _GL_ARG_NONNULL ((1))
353rpl_fseek (FILE *fp, long offset, int whence)
354{
a927b6c1
LC
355# if @REPLACE_FSEEKO@
356 return rpl_fseeko (fp, offset, whence);
357# else
61cd9dc9 358 return fseeko (fp, offset, whence);
8912421c 359# endif
a927b6c1 360}
c4b681fd
LC
361# endif
362#elif defined GNULIB_POSIXCHECK
61cd9dc9
LC
363# define _GL_FSEEK_WARN /* Category 1, above. */
364# undef fseek
8912421c 365# undef fseeko
61cd9dc9
LC
366# if HAVE_RAW_DECL_FSEEKO
367_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
368 "use gnulib module fseeko for portability");
369# endif
c4b681fd
LC
370#endif
371
61cd9dc9
LC
372#ifdef _GL_FSEEK_WARN
373# undef _GL_FSEEK_WARN
374/* Here, either fseek is undefined (but C89 guarantees that it is
375 declared), or it is defined as rpl_fseek (declared above). */
376_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
377 "on 32-bit platforms - "
378 "use fseeko function for handling of large files");
379#endif
380
f4c79b3c
LC
381
382/* ftell, ftello. See the comments on fseek/fseeko. */
61cd9dc9
LC
383
384#if @GNULIB_FTELL@
385# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
386# define _GL_FTELL_WARN /* Category 2, above. */
387# undef ftell
8912421c 388# endif
61cd9dc9 389# if @REPLACE_FTELL@
f4c79b3c
LC
390# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
391# undef ftell
392# define ftell rpl_ftell
393# endif
394_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
395_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
396# else
397_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
8912421c 398# endif
f4c79b3c 399_GL_CXXALIASWARN (ftell);
8912421c
LC
400#endif
401
402#if @GNULIB_FTELLO@
61cd9dc9
LC
403# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
404# define _GL_FTELL_WARN /* Category 3, above. */
405# undef ftell
406# endif
8912421c 407# if @REPLACE_FTELLO@
f4c79b3c
LC
408# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
409# undef ftello
410# define ftello rpl_ftello
411# endif
412_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
a927b6c1
LC
413_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
414# else
415# if ! @HAVE_FTELLO@
416_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
417# endif
418_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
419# endif
420_GL_CXXALIASWARN (ftello);
421# if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@
422 /* Provide an ftell function that is consistent with ftello. */
423 /* In order to avoid that ftell gets defined as a macro here, the
424 developer can request the 'ftell' module. */
425# undef ftell
426# define ftell rpl_ftell
61cd9dc9
LC
427static inline long _GL_ARG_NONNULL ((1))
428rpl_ftell (FILE *f)
429{
a927b6c1
LC
430# if @REPLACE_FTELLO@
431 return rpl_ftello (f);
432# else
61cd9dc9 433 return ftello (f);
8912421c 434# endif
a927b6c1 435}
8912421c
LC
436# endif
437#elif defined GNULIB_POSIXCHECK
61cd9dc9
LC
438# define _GL_FTELL_WARN /* Category 1, above. */
439# undef ftell
8912421c 440# undef ftello
61cd9dc9
LC
441# if HAVE_RAW_DECL_FTELLO
442_GL_WARN_ON_USE (ftello, "ftello is unportable - "
443 "use gnulib module ftello for portability");
444# endif
445#endif
446
447#ifdef _GL_FTELL_WARN
448# undef _GL_FTELL_WARN
449/* Here, either ftell is undefined (but C89 guarantees that it is
450 declared), or it is defined as rpl_ftell (declared above). */
451_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
452 "on 32-bit platforms - "
453 "use ftello function for handling of large files");
c4b681fd
LC
454#endif
455
f4c79b3c
LC
456
457#if @GNULIB_FWRITE@
458# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
459# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
460# undef fwrite
461# define fwrite rpl_fwrite
462# endif
463_GL_FUNCDECL_RPL (fwrite, size_t,
464 (const void *ptr, size_t s, size_t n, FILE *stream)
465 _GL_ARG_NONNULL ((1, 4)));
466_GL_CXXALIAS_RPL (fwrite, size_t,
467 (const void *ptr, size_t s, size_t n, FILE *stream));
468# else
469_GL_CXXALIAS_SYS (fwrite, size_t,
470 (const void *ptr, size_t s, size_t n, FILE *stream));
471# endif
472_GL_CXXALIASWARN (fwrite);
c4b681fd
LC
473#endif
474
475#if @GNULIB_GETDELIM@
c4b681fd
LC
476/* Read input, up to (and including) the next occurrence of DELIMITER, from
477 STREAM, store it in *LINEPTR (and NUL-terminate it).
478 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
479 bytes of space. It is realloc'd as necessary.
480 Return the number of bytes read and stored at *LINEPTR (not including the
481 NUL terminator), or -1 on error or EOF. */
f4c79b3c
LC
482# if @REPLACE_GETDELIM@
483# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
484# undef getdelim
485# define getdelim rpl_getdelim
486# endif
487_GL_FUNCDECL_RPL (getdelim, ssize_t,
488 (char **lineptr, size_t *linesize, int delimiter,
489 FILE *stream)
490 _GL_ARG_NONNULL ((1, 2, 4)));
491_GL_CXXALIAS_RPL (getdelim, ssize_t,
492 (char **lineptr, size_t *linesize, int delimiter,
493 FILE *stream));
494# else
495# if !@HAVE_DECL_GETDELIM@
496_GL_FUNCDECL_SYS (getdelim, ssize_t,
497 (char **lineptr, size_t *linesize, int delimiter,
498 FILE *stream)
499 _GL_ARG_NONNULL ((1, 2, 4)));
500# endif
501_GL_CXXALIAS_SYS (getdelim, ssize_t,
502 (char **lineptr, size_t *linesize, int delimiter,
503 FILE *stream));
c4b681fd 504# endif
f4c79b3c 505_GL_CXXALIASWARN (getdelim);
c4b681fd
LC
506#elif defined GNULIB_POSIXCHECK
507# undef getdelim
61cd9dc9
LC
508# if HAVE_RAW_DECL_GETDELIM
509_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
510 "use gnulib module getdelim for portability");
511# endif
c4b681fd
LC
512#endif
513
514#if @GNULIB_GETLINE@
c4b681fd
LC
515/* Read a line, up to (and including) the next newline, from STREAM, store it
516 in *LINEPTR (and NUL-terminate it).
517 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
518 bytes of space. It is realloc'd as necessary.
519 Return the number of bytes read and stored at *LINEPTR (not including the
520 NUL terminator), or -1 on error or EOF. */
f4c79b3c
LC
521# if @REPLACE_GETLINE@
522# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
523# undef getline
524# define getline rpl_getline
525# endif
526_GL_FUNCDECL_RPL (getline, ssize_t,
527 (char **lineptr, size_t *linesize, FILE *stream)
528 _GL_ARG_NONNULL ((1, 2, 3)));
529_GL_CXXALIAS_RPL (getline, ssize_t,
530 (char **lineptr, size_t *linesize, FILE *stream));
531# else
532# if !@HAVE_DECL_GETLINE@
533_GL_FUNCDECL_SYS (getline, ssize_t,
534 (char **lineptr, size_t *linesize, FILE *stream)
535 _GL_ARG_NONNULL ((1, 2, 3)));
536# endif
537_GL_CXXALIAS_SYS (getline, ssize_t,
538 (char **lineptr, size_t *linesize, FILE *stream));
c4b681fd 539# endif
a927b6c1 540# if @HAVE_DECL_GETLINE@
f4c79b3c 541_GL_CXXALIASWARN (getline);
a927b6c1 542# endif
c4b681fd
LC
543#elif defined GNULIB_POSIXCHECK
544# undef getline
61cd9dc9
LC
545# if HAVE_RAW_DECL_GETLINE
546_GL_WARN_ON_USE (getline, "getline is unportable - "
547 "use gnulib module getline for portability");
548# endif
c4b681fd
LC
549#endif
550
61cd9dc9 551#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
f4c79b3c
LC
552struct obstack;
553/* Grow an obstack with formatted output. Return the number of
554 bytes added to OBS. No trailing nul byte is added, and the
555 object should be closed with obstack_finish before use. Upon
556 memory allocation error, call obstack_alloc_failed_handler. Upon
557 other error, return -1. */
8912421c 558# if @REPLACE_OBSTACK_PRINTF@
f4c79b3c
LC
559# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
560# define obstack_printf rpl_obstack_printf
561# endif
562_GL_FUNCDECL_RPL (obstack_printf, int,
563 (struct obstack *obs, const char *format, ...)
564 __attribute__ ((__format__ (__printf__, 2, 3)))
565 _GL_ARG_NONNULL ((1, 2)));
566_GL_CXXALIAS_RPL (obstack_printf, int,
567 (struct obstack *obs, const char *format, ...));
568# else
569# if !@HAVE_DECL_OBSTACK_PRINTF@
570_GL_FUNCDECL_SYS (obstack_printf, int,
571 (struct obstack *obs, const char *format, ...)
572 __attribute__ ((__format__ (__printf__, 2, 3)))
573 _GL_ARG_NONNULL ((1, 2)));
574# endif
575_GL_CXXALIAS_SYS (obstack_printf, int,
576 (struct obstack *obs, const char *format, ...));
8912421c 577# endif
f4c79b3c
LC
578_GL_CXXALIASWARN (obstack_printf);
579# if @REPLACE_OBSTACK_PRINTF@
580# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
581# define obstack_vprintf rpl_obstack_vprintf
582# endif
583_GL_FUNCDECL_RPL (obstack_vprintf, int,
584 (struct obstack *obs, const char *format, va_list args)
585 __attribute__ ((__format__ (__printf__, 2, 0)))
586 _GL_ARG_NONNULL ((1, 2)));
587_GL_CXXALIAS_RPL (obstack_vprintf, int,
588 (struct obstack *obs, const char *format, va_list args));
589# else
590# if !@HAVE_DECL_OBSTACK_PRINTF@
591_GL_FUNCDECL_SYS (obstack_vprintf, int,
592 (struct obstack *obs, const char *format, va_list args)
593 __attribute__ ((__format__ (__printf__, 2, 0)))
594 _GL_ARG_NONNULL ((1, 2)));
595# endif
596_GL_CXXALIAS_SYS (obstack_vprintf, int,
597 (struct obstack *obs, const char *format, va_list args));
8912421c 598# endif
f4c79b3c 599_GL_CXXALIASWARN (obstack_vprintf);
8912421c
LC
600#endif
601
c4b681fd 602#if @GNULIB_PERROR@
c4b681fd
LC
603/* Print a message to standard error, describing the value of ERRNO,
604 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
605 and terminated with a newline. */
f4c79b3c
LC
606# if @REPLACE_PERROR@
607# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
608# define perror rpl_perror
609# endif
610_GL_FUNCDECL_RPL (perror, void, (const char *string));
611_GL_CXXALIAS_RPL (perror, void, (const char *string));
612# else
613_GL_CXXALIAS_SYS (perror, void, (const char *string));
c4b681fd 614# endif
f4c79b3c 615_GL_CXXALIASWARN (perror);
c4b681fd
LC
616#elif defined GNULIB_POSIXCHECK
617# undef perror
61cd9dc9
LC
618/* Assume perror is always declared. */
619_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
620 "use gnulib module perror for portability");
c4b681fd
LC
621#endif
622
8912421c
LC
623#if @GNULIB_POPEN@
624# if @REPLACE_POPEN@
f4c79b3c
LC
625# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
626# undef popen
627# define popen rpl_popen
628# endif
629_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
630 _GL_ARG_NONNULL ((1, 2)));
631_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
632# else
633_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
8912421c 634# endif
f4c79b3c 635_GL_CXXALIASWARN (popen);
8912421c
LC
636#elif defined GNULIB_POSIXCHECK
637# undef popen
61cd9dc9
LC
638# if HAVE_RAW_DECL_POPEN
639_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
640 "use gnulib module popen or pipe for more portability");
641# endif
8912421c
LC
642#endif
643
f4c79b3c
LC
644#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
645# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
646 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
a927b6c1
LC
647# if defined __GNUC__
648# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
8912421c 649/* Don't break __attribute__((format(printf,M,N))). */
a927b6c1
LC
650# define printf __printf__
651# endif
f4c79b3c
LC
652_GL_FUNCDECL_RPL_1 (__printf__, int,
653 (const char *format, ...)
a927b6c1
LC
654 __asm__ (@ASM_SYMBOL_PREFIX@
655 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
f4c79b3c
LC
656 __attribute__ ((__format__ (__printf__, 1, 2)))
657 _GL_ARG_NONNULL ((1)));
658_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
a927b6c1
LC
659# else
660_GL_FUNCDECL_RPL (printf, int,
661 (const char *format, ...)
662 __attribute__ ((__format__ (__printf__, 1, 2)))
663 _GL_ARG_NONNULL ((1)));
664_GL_CXXALIAS_RPL (printf, printf, int, (const char *format, ...));
665# endif
666# define GNULIB_overrides_printf 1
f4c79b3c
LC
667# else
668_GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
669# endif
670_GL_CXXALIASWARN (printf);
671#endif
672#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
673# if !GNULIB_overrides_printf
674# undef printf
8912421c 675# endif
61cd9dc9
LC
676/* Assume printf is always declared. */
677_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
678 "use gnulib module printf-posix for portable "
679 "POSIX compliance");
8912421c
LC
680#endif
681
f4c79b3c
LC
682#if @GNULIB_PUTC@
683# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
684# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
685# undef putc
686# define putc rpl_fputc
687# endif
688_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
689_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
690# else
691_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
692# endif
693_GL_CXXALIASWARN (putc);
8912421c
LC
694#endif
695
f4c79b3c
LC
696#if @GNULIB_PUTCHAR@
697# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
698# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
699# undef putchar
700# define putchar rpl_putchar
701# endif
702_GL_FUNCDECL_RPL (putchar, int, (int c));
703_GL_CXXALIAS_RPL (putchar, int, (int c));
704# else
705_GL_CXXALIAS_SYS (putchar, int, (int c));
706# endif
707_GL_CXXALIASWARN (putchar);
8912421c
LC
708#endif
709
f4c79b3c
LC
710#if @GNULIB_PUTS@
711# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
712# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
713# undef puts
714# define puts rpl_puts
715# endif
716_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
717_GL_CXXALIAS_RPL (puts, int, (const char *string));
718# else
719_GL_CXXALIAS_SYS (puts, int, (const char *string));
720# endif
721_GL_CXXALIASWARN (puts);
8912421c
LC
722#endif
723
724#if @GNULIB_REMOVE@
725# if @REPLACE_REMOVE@
f4c79b3c
LC
726# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
727# undef remove
728# define remove rpl_remove
729# endif
730_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
731_GL_CXXALIAS_RPL (remove, int, (const char *name));
732# else
733_GL_CXXALIAS_SYS (remove, int, (const char *name));
8912421c 734# endif
f4c79b3c 735_GL_CXXALIASWARN (remove);
8912421c
LC
736#elif defined GNULIB_POSIXCHECK
737# undef remove
61cd9dc9
LC
738/* Assume remove is always declared. */
739_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
740 "use gnulib module remove for more portability");
8912421c
LC
741#endif
742
743#if @GNULIB_RENAME@
744# if @REPLACE_RENAME@
f4c79b3c
LC
745# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
746# undef rename
747# define rename rpl_rename
748# endif
749_GL_FUNCDECL_RPL (rename, int,
750 (const char *old_filename, const char *new_filename)
751 _GL_ARG_NONNULL ((1, 2)));
752_GL_CXXALIAS_RPL (rename, int,
753 (const char *old_filename, const char *new_filename));
754# else
755_GL_CXXALIAS_SYS (rename, int,
756 (const char *old_filename, const char *new_filename));
757# endif
758_GL_CXXALIASWARN (rename);
8912421c
LC
759#elif defined GNULIB_POSIXCHECK
760# undef rename
61cd9dc9
LC
761/* Assume rename is always declared. */
762_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
763 "use gnulib module rename for more portability");
8912421c
LC
764#endif
765
766#if @GNULIB_RENAMEAT@
767# if @REPLACE_RENAMEAT@
f4c79b3c
LC
768# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
769# undef renameat
770# define renameat rpl_renameat
771# endif
772_GL_FUNCDECL_RPL (renameat, int,
773 (int fd1, char const *file1, int fd2, char const *file2)
774 _GL_ARG_NONNULL ((2, 4)));
775_GL_CXXALIAS_RPL (renameat, int,
776 (int fd1, char const *file1, int fd2, char const *file2));
777# else
778# if !@HAVE_RENAMEAT@
779_GL_FUNCDECL_SYS (renameat, int,
780 (int fd1, char const *file1, int fd2, char const *file2)
781 _GL_ARG_NONNULL ((2, 4)));
782# endif
783_GL_CXXALIAS_SYS (renameat, int,
784 (int fd1, char const *file1, int fd2, char const *file2));
8912421c 785# endif
f4c79b3c 786_GL_CXXALIASWARN (renameat);
8912421c
LC
787#elif defined GNULIB_POSIXCHECK
788# undef renameat
61cd9dc9
LC
789# if HAVE_RAW_DECL_RENAMEAT
790_GL_WARN_ON_USE (renameat, "renameat is not portable - "
791 "use gnulib module renameat for portability");
792# endif
8912421c
LC
793#endif
794
795#if @GNULIB_SNPRINTF@
796# if @REPLACE_SNPRINTF@
f4c79b3c
LC
797# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
798# define snprintf rpl_snprintf
799# endif
800_GL_FUNCDECL_RPL (snprintf, int,
801 (char *str, size_t size, const char *format, ...)
802 __attribute__ ((__format__ (__printf__, 3, 4)))
803 _GL_ARG_NONNULL ((3)));
804_GL_CXXALIAS_RPL (snprintf, int,
805 (char *str, size_t size, const char *format, ...));
806# else
807# if !@HAVE_DECL_SNPRINTF@
808_GL_FUNCDECL_SYS (snprintf, int,
809 (char *str, size_t size, const char *format, ...)
810 __attribute__ ((__format__ (__printf__, 3, 4)))
811 _GL_ARG_NONNULL ((3)));
812# endif
813_GL_CXXALIAS_SYS (snprintf, int,
814 (char *str, size_t size, const char *format, ...));
8912421c 815# endif
f4c79b3c 816_GL_CXXALIASWARN (snprintf);
8912421c
LC
817#elif defined GNULIB_POSIXCHECK
818# undef snprintf
61cd9dc9
LC
819# if HAVE_RAW_DECL_SNPRINTF
820_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
821 "use gnulib module snprintf for portability");
822# endif
8912421c
LC
823#endif
824
61cd9dc9
LC
825/* Some people would argue that sprintf should be handled like gets
826 (for example, OpenBSD issues a link warning for both functions),
827 since both can cause security holes due to buffer overruns.
828 However, we believe that sprintf can be used safely, and is more
829 efficient than snprintf in those safe cases; and as proof of our
830 belief, we use sprintf in several gnulib modules. So this header
831 intentionally avoids adding a warning to sprintf except when
832 GNULIB_POSIXCHECK is defined. */
833
8912421c
LC
834#if @GNULIB_SPRINTF_POSIX@
835# if @REPLACE_SPRINTF@
f4c79b3c
LC
836# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
837# define sprintf rpl_sprintf
838# endif
839_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
840 __attribute__ ((__format__ (__printf__, 2, 3)))
841 _GL_ARG_NONNULL ((1, 2)));
842_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
843# else
844_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
845# endif
846_GL_CXXALIASWARN (sprintf);
8912421c
LC
847#elif defined GNULIB_POSIXCHECK
848# undef sprintf
61cd9dc9
LC
849/* Assume sprintf is always declared. */
850_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
851 "use gnulib module sprintf-posix for portable "
852 "POSIX compliance");
8912421c
LC
853#endif
854
a927b6c1
LC
855#if @GNULIB_TMPFILE@
856# if @REPLACE_TMPFILE@
857# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
858# define tmpfile rpl_tmpfile
859# endif
860_GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
861_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
862# else
863_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
864# endif
865_GL_CXXALIASWARN (tmpfile);
866#elif defined GNULIB_POSIXCHECK
867# undef tmpfile
868# if HAVE_RAW_DECL_TMPFILE
869_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
870 "use gnulib module tmpfile for portability");
871# endif
872#endif
873
8912421c 874#if @GNULIB_VASPRINTF@
f4c79b3c
LC
875/* Write formatted output to a string dynamically allocated with malloc().
876 If the memory allocation succeeds, store the address of the string in
877 *RESULT and return the number of resulting bytes, excluding the trailing
878 NUL. Upon memory allocation error, or some other error, return -1. */
8912421c 879# if @REPLACE_VASPRINTF@
f4c79b3c
LC
880# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
881# define asprintf rpl_asprintf
882# endif
883_GL_FUNCDECL_RPL (asprintf, int,
884 (char **result, const char *format, ...)
885 __attribute__ ((__format__ (__printf__, 2, 3)))
886 _GL_ARG_NONNULL ((1, 2)));
887_GL_CXXALIAS_RPL (asprintf, int,
888 (char **result, const char *format, ...));
889# else
890# if !@HAVE_VASPRINTF@
891_GL_FUNCDECL_SYS (asprintf, int,
892 (char **result, const char *format, ...)
893 __attribute__ ((__format__ (__printf__, 2, 3)))
894 _GL_ARG_NONNULL ((1, 2)));
895# endif
896_GL_CXXALIAS_SYS (asprintf, int,
897 (char **result, const char *format, ...));
8912421c 898# endif
f4c79b3c
LC
899_GL_CXXALIASWARN (asprintf);
900# if @REPLACE_VASPRINTF@
901# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
902# define vasprintf rpl_vasprintf
903# endif
904_GL_FUNCDECL_RPL (vasprintf, int,
905 (char **result, const char *format, va_list args)
906 __attribute__ ((__format__ (__printf__, 2, 0)))
907 _GL_ARG_NONNULL ((1, 2)));
908_GL_CXXALIAS_RPL (vasprintf, int,
909 (char **result, const char *format, va_list args));
910# else
911# if !@HAVE_VASPRINTF@
912_GL_FUNCDECL_SYS (vasprintf, int,
913 (char **result, const char *format, va_list args)
914 __attribute__ ((__format__ (__printf__, 2, 0)))
915 _GL_ARG_NONNULL ((1, 2)));
916# endif
917_GL_CXXALIAS_SYS (vasprintf, int,
918 (char **result, const char *format, va_list args));
8912421c 919# endif
f4c79b3c 920_GL_CXXALIASWARN (vasprintf);
8912421c
LC
921#endif
922
923#if @GNULIB_VDPRINTF@
924# if @REPLACE_VDPRINTF@
f4c79b3c
LC
925# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
926# define vdprintf rpl_vdprintf
927# endif
928_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
929 __attribute__ ((__format__ (__printf__, 2, 0)))
930 _GL_ARG_NONNULL ((2)));
931_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
932# else
933# if !@HAVE_VDPRINTF@
934_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
935 __attribute__ ((__format__ (__printf__, 2, 0)))
936 _GL_ARG_NONNULL ((2)));
937# endif
a927b6c1
LC
938/* Need to cast, because on Solaris, the third parameter will likely be
939 __va_list args. */
940_GL_CXXALIAS_SYS_CAST (vdprintf, int,
941 (int fd, const char *format, va_list args));
8912421c 942# endif
f4c79b3c 943_GL_CXXALIASWARN (vdprintf);
8912421c
LC
944#elif defined GNULIB_POSIXCHECK
945# undef vdprintf
61cd9dc9
LC
946# if HAVE_RAW_DECL_VDPRINTF
947_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
948 "use gnulib module vdprintf for portability");
949# endif
8912421c
LC
950#endif
951
f4c79b3c
LC
952#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
953# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
954 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
955# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
956# define vfprintf rpl_vfprintf
957# endif
958# define GNULIB_overrides_vfprintf 1
959_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
960 __attribute__ ((__format__ (__printf__, 2, 0)))
961 _GL_ARG_NONNULL ((1, 2)));
962_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
963# else
a927b6c1
LC
964/* Need to cast, because on Solaris, the third parameter is
965 __va_list args
966 and GCC's fixincludes did not change this to __gnuc_va_list. */
967_GL_CXXALIAS_SYS_CAST (vfprintf, int,
968 (FILE *fp, const char *format, va_list args));
f4c79b3c
LC
969# endif
970_GL_CXXALIASWARN (vfprintf);
971#endif
972#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
973# if !GNULIB_overrides_vfprintf
974# undef vfprintf
8912421c 975# endif
61cd9dc9
LC
976/* Assume vfprintf is always declared. */
977_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
978 "use gnulib module vfprintf-posix for portable "
979 "POSIX compliance");
8912421c
LC
980#endif
981
f4c79b3c
LC
982#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
983# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
984 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
985# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
986# define vprintf rpl_vprintf
987# endif
988# define GNULIB_overrides_vprintf 1
989_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
990 __attribute__ ((__format__ (__printf__, 1, 0)))
991 _GL_ARG_NONNULL ((1)));
992_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
993# else
a927b6c1
LC
994/* Need to cast, because on Solaris, the second parameter is
995 __va_list args
996 and GCC's fixincludes did not change this to __gnuc_va_list. */
997_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
f4c79b3c
LC
998# endif
999_GL_CXXALIASWARN (vprintf);
1000#endif
1001#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1002# if !GNULIB_overrides_vprintf
1003# undef vprintf
8912421c 1004# endif
61cd9dc9
LC
1005/* Assume vprintf is always declared. */
1006_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1007 "use gnulib module vprintf-posix for portable "
1008 "POSIX compliance");
8912421c
LC
1009#endif
1010
1011#if @GNULIB_VSNPRINTF@
1012# if @REPLACE_VSNPRINTF@
f4c79b3c
LC
1013# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1014# define vsnprintf rpl_vsnprintf
1015# endif
1016_GL_FUNCDECL_RPL (vsnprintf, int,
1017 (char *str, size_t size, const char *format, va_list args)
1018 __attribute__ ((__format__ (__printf__, 3, 0)))
1019 _GL_ARG_NONNULL ((3)));
1020_GL_CXXALIAS_RPL (vsnprintf, int,
1021 (char *str, size_t size, const char *format, va_list args));
1022# else
1023# if !@HAVE_DECL_VSNPRINTF@
1024_GL_FUNCDECL_SYS (vsnprintf, int,
1025 (char *str, size_t size, const char *format, va_list args)
1026 __attribute__ ((__format__ (__printf__, 3, 0)))
1027 _GL_ARG_NONNULL ((3)));
1028# endif
1029_GL_CXXALIAS_SYS (vsnprintf, int,
1030 (char *str, size_t size, const char *format, va_list args));
8912421c 1031# endif
f4c79b3c 1032_GL_CXXALIASWARN (vsnprintf);
8912421c
LC
1033#elif defined GNULIB_POSIXCHECK
1034# undef vsnprintf
61cd9dc9
LC
1035# if HAVE_RAW_DECL_VSNPRINTF
1036_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1037 "use gnulib module vsnprintf for portability");
1038# endif
8912421c
LC
1039#endif
1040
1041#if @GNULIB_VSPRINTF_POSIX@
1042# if @REPLACE_VSPRINTF@
f4c79b3c
LC
1043# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1044# define vsprintf rpl_vsprintf
1045# endif
1046_GL_FUNCDECL_RPL (vsprintf, int,
1047 (char *str, const char *format, va_list args)
1048 __attribute__ ((__format__ (__printf__, 2, 0)))
1049 _GL_ARG_NONNULL ((1, 2)));
1050_GL_CXXALIAS_RPL (vsprintf, int,
1051 (char *str, const char *format, va_list args));
1052# else
a927b6c1
LC
1053/* Need to cast, because on Solaris, the third parameter is
1054 __va_list args
1055 and GCC's fixincludes did not change this to __gnuc_va_list. */
1056_GL_CXXALIAS_SYS_CAST (vsprintf, int,
1057 (char *str, const char *format, va_list args));
f4c79b3c
LC
1058# endif
1059_GL_CXXALIASWARN (vsprintf);
8912421c
LC
1060#elif defined GNULIB_POSIXCHECK
1061# undef vsprintf
61cd9dc9
LC
1062/* Assume vsprintf is always declared. */
1063_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
1064 "use gnulib module vsprintf-posix for portable "
1065 "POSIX compliance");
8912421c
LC
1066#endif
1067
c4b681fd
LC
1068
1069#endif /* _GL_STDIO_H */
1070#endif /* _GL_STDIO_H */
1071#endif