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