Code

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