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