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