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