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