Import upstream version 1.28
[debian/tar] / gnu / stdio.in.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A GNU-like <stdio.h>.
4
5    Copyright (C) 2004, 2007-2014 Free Software Foundation, Inc.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3, or (at your option)
10    any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
19
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24
25 #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
26 /* Special invocation convention:
27    - Inside glibc header files.
28    - On OSF/1 5.1 we have a sequence of nested includes
29      <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
30      <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
31      In this situation, the functions are not yet declared, therefore we cannot
32      provide the C++ aliases.  */
33
34 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
35
36 #else
37 /* Normal invocation convention.  */
38
39 #ifndef _@GUARD_PREFIX@_STDIO_H
40
41 #define _GL_ALREADY_INCLUDING_STDIO_H
42
43 /* The include_next requires a split double-inclusion guard.  */
44 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
45
46 #undef _GL_ALREADY_INCLUDING_STDIO_H
47
48 #ifndef _@GUARD_PREFIX@_STDIO_H
49 #define _@GUARD_PREFIX@_STDIO_H
50
51 /* Get va_list.  Needed on many systems, including glibc 2.8.  */
52 #include <stdarg.h>
53
54 #include <stddef.h>
55
56 /* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8
57    and eglibc 2.11.2.
58    May also define off_t to a 64-bit type on native Windows.  */
59 #include <sys/types.h>
60
61 /* The __attribute__ feature is available in gcc versions 2.5 and later.
62    The __-protected variants of the attributes 'format' and 'printf' are
63    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
64    We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
65    gnulib and libintl do '#define printf __printf__' when they override
66    the 'printf' function.  */
67 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
68 # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
69 #else
70 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
71 #endif
72
73 /* _GL_ATTRIBUTE_FORMAT_PRINTF
74    indicates to GCC that the function takes a format string and arguments,
75    where the format string directives are the ones standardized by ISO C99
76    and POSIX.  */
77 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
78 # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
79    _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
80 #else
81 # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
82    _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
83 #endif
84
85 /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
86    except that it indicates to GCC that the supported format string directives
87    are the ones of the system printf(), rather than the ones standardized by
88    ISO C99 and POSIX.  */
89 #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
90   _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
91
92 /* _GL_ATTRIBUTE_FORMAT_SCANF
93    indicates to GCC that the function takes a format string and arguments,
94    where the format string directives are the ones standardized by ISO C99
95    and POSIX.  */
96 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
97 # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
98    _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
99 #else
100 # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
101    _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
102 #endif
103
104 /* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
105    except that it indicates to GCC that the supported format string directives
106    are the ones of the system scanf(), rather than the ones standardized by
107    ISO C99 and POSIX.  */
108 #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
109   _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
110
111 /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>.  */
112 /* But in any case avoid namespace pollution on glibc systems.  */
113 #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
114     && ! defined __GLIBC__
115 # include <unistd.h>
116 #endif
117
118
119 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
120
121 /* The definition of _GL_ARG_NONNULL is copied here.  */
122
123 /* The definition of _GL_WARN_ON_USE is copied here.  */
124
125 /* Macros for stringification.  */
126 #define _GL_STDIO_STRINGIZE(token) #token
127 #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
128
129 /* When also using extern inline, suppress the use of static inline in
130    standard headers of problematic Apple configurations, as Libc at
131    least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
132    <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
133    Perhaps Apple will fix this some day.  */
134 #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
135      && defined __GNUC__ && defined __STDC__)
136 # undef putc_unlocked
137 #endif
138
139 #if @GNULIB_DPRINTF@
140 # if @REPLACE_DPRINTF@
141 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
142 #   define dprintf rpl_dprintf
143 #  endif
144 _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
145                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
146                                 _GL_ARG_NONNULL ((2)));
147 _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
148 # else
149 #  if !@HAVE_DPRINTF@
150 _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
151                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
152                                 _GL_ARG_NONNULL ((2)));
153 #  endif
154 _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
155 # endif
156 _GL_CXXALIASWARN (dprintf);
157 #elif defined GNULIB_POSIXCHECK
158 # undef dprintf
159 # if HAVE_RAW_DECL_DPRINTF
160 _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
161                  "use gnulib module dprintf for portability");
162 # endif
163 #endif
164
165 #if @GNULIB_FCLOSE@
166 /* Close STREAM and its underlying file descriptor.  */
167 # if @REPLACE_FCLOSE@
168 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
169 #   define fclose rpl_fclose
170 #  endif
171 _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
172 _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
173 # else
174 _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
175 # endif
176 _GL_CXXALIASWARN (fclose);
177 #elif defined GNULIB_POSIXCHECK
178 # undef fclose
179 /* Assume fclose is always declared.  */
180 _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
181                  "use gnulib module fclose for portable POSIX compliance");
182 #endif
183
184 #if @GNULIB_FDOPEN@
185 # if @REPLACE_FDOPEN@
186 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
187 #   undef fdopen
188 #   define fdopen rpl_fdopen
189 #  endif
190 _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
191                                   _GL_ARG_NONNULL ((2)));
192 _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
193 # else
194 _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
195 # endif
196 _GL_CXXALIASWARN (fdopen);
197 #elif defined GNULIB_POSIXCHECK
198 # undef fdopen
199 /* Assume fdopen is always declared.  */
200 _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
201                  "use gnulib module fdopen for portability");
202 #endif
203
204 #if @GNULIB_FFLUSH@
205 /* Flush all pending data on STREAM according to POSIX rules.  Both
206    output and seekable input streams are supported.
207    Note! LOSS OF DATA can occur if fflush is applied on an input stream
208    that is _not_seekable_ or on an update stream that is _not_seekable_
209    and in which the most recent operation was input.  Seekability can
210    be tested with lseek(fileno(fp),0,SEEK_CUR).  */
211 # if @REPLACE_FFLUSH@
212 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
213 #   define fflush rpl_fflush
214 #  endif
215 _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
216 _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
217 # else
218 _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
219 # endif
220 _GL_CXXALIASWARN (fflush);
221 #elif defined GNULIB_POSIXCHECK
222 # undef fflush
223 /* Assume fflush is always declared.  */
224 _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
225                  "use gnulib module fflush for portable POSIX compliance");
226 #endif
227
228 #if @GNULIB_FGETC@
229 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
230 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
231 #   undef fgetc
232 #   define fgetc rpl_fgetc
233 #  endif
234 _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
235 _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
236 # else
237 _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
238 # endif
239 _GL_CXXALIASWARN (fgetc);
240 #endif
241
242 #if @GNULIB_FGETS@
243 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
244 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
245 #   undef fgets
246 #   define fgets rpl_fgets
247 #  endif
248 _GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
249                                  _GL_ARG_NONNULL ((1, 3)));
250 _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
251 # else
252 _GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
253 # endif
254 _GL_CXXALIASWARN (fgets);
255 #endif
256
257 #if @GNULIB_FOPEN@
258 # if @REPLACE_FOPEN@
259 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
260 #   undef fopen
261 #   define fopen rpl_fopen
262 #  endif
263 _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
264                                  _GL_ARG_NONNULL ((1, 2)));
265 _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
266 # else
267 _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
268 # endif
269 _GL_CXXALIASWARN (fopen);
270 #elif defined GNULIB_POSIXCHECK
271 # undef fopen
272 /* Assume fopen is always declared.  */
273 _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
274                  "use gnulib module fopen for portability");
275 #endif
276
277 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
278 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
279      || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
280 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
281 #   define fprintf rpl_fprintf
282 #  endif
283 #  define GNULIB_overrides_fprintf 1
284 #  if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
285 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
286                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
287                                 _GL_ARG_NONNULL ((1, 2)));
288 #  else
289 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
290                                 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
291                                 _GL_ARG_NONNULL ((1, 2)));
292 #  endif
293 _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
294 # else
295 _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
296 # endif
297 _GL_CXXALIASWARN (fprintf);
298 #endif
299 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
300 # if !GNULIB_overrides_fprintf
301 #  undef fprintf
302 # endif
303 /* Assume fprintf is always declared.  */
304 _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
305                  "use gnulib module fprintf-posix for portable "
306                  "POSIX compliance");
307 #endif
308
309 #if @GNULIB_FPURGE@
310 /* Discard all pending buffered I/O data on STREAM.
311    STREAM must not be wide-character oriented.
312    When discarding pending output, the file position is set back to where it
313    was before the write calls.  When discarding pending input, the file
314    position is advanced to match the end of the previously read input.
315    Return 0 if successful.  Upon error, return -1 and set errno.  */
316 # if @REPLACE_FPURGE@
317 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
318 #   define fpurge rpl_fpurge
319 #  endif
320 _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
321 _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
322 # else
323 #  if !@HAVE_DECL_FPURGE@
324 _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
325 #  endif
326 _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
327 # endif
328 _GL_CXXALIASWARN (fpurge);
329 #elif defined GNULIB_POSIXCHECK
330 # undef fpurge
331 # if HAVE_RAW_DECL_FPURGE
332 _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
333                  "use gnulib module fpurge for portability");
334 # endif
335 #endif
336
337 #if @GNULIB_FPUTC@
338 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
339 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
340 #   undef fputc
341 #   define fputc rpl_fputc
342 #  endif
343 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
344 _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
345 # else
346 _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
347 # endif
348 _GL_CXXALIASWARN (fputc);
349 #endif
350
351 #if @GNULIB_FPUTS@
352 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
353 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
354 #   undef fputs
355 #   define fputs rpl_fputs
356 #  endif
357 _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
358                               _GL_ARG_NONNULL ((1, 2)));
359 _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
360 # else
361 _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
362 # endif
363 _GL_CXXALIASWARN (fputs);
364 #endif
365
366 #if @GNULIB_FREAD@
367 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
368 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
369 #   undef fread
370 #   define fread rpl_fread
371 #  endif
372 _GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
373                                  _GL_ARG_NONNULL ((4)));
374 _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
375 # else
376 _GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
377 # endif
378 _GL_CXXALIASWARN (fread);
379 #endif
380
381 #if @GNULIB_FREOPEN@
382 # if @REPLACE_FREOPEN@
383 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
384 #   undef freopen
385 #   define freopen rpl_freopen
386 #  endif
387 _GL_FUNCDECL_RPL (freopen, FILE *,
388                   (const char *filename, const char *mode, FILE *stream)
389                   _GL_ARG_NONNULL ((2, 3)));
390 _GL_CXXALIAS_RPL (freopen, FILE *,
391                   (const char *filename, const char *mode, FILE *stream));
392 # else
393 _GL_CXXALIAS_SYS (freopen, FILE *,
394                   (const char *filename, const char *mode, FILE *stream));
395 # endif
396 _GL_CXXALIASWARN (freopen);
397 #elif defined GNULIB_POSIXCHECK
398 # undef freopen
399 /* Assume freopen is always declared.  */
400 _GL_WARN_ON_USE (freopen,
401                  "freopen on native Windows platforms is not POSIX compliant - "
402                  "use gnulib module freopen for portability");
403 #endif
404
405 #if @GNULIB_FSCANF@
406 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
407 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
408 #   undef fscanf
409 #   define fscanf rpl_fscanf
410 #  endif
411 _GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
412                                _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
413                                _GL_ARG_NONNULL ((1, 2)));
414 _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
415 # else
416 _GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
417 # endif
418 _GL_CXXALIASWARN (fscanf);
419 #endif
420
421
422 /* Set up the following warnings, based on which modules are in use.
423    GNU Coding Standards discourage the use of fseek, since it imposes
424    an arbitrary limitation on some 32-bit hosts.  Remember that the
425    fseek module depends on the fseeko module, so we only have three
426    cases to consider:
427
428    1. The developer is not using either module.  Issue a warning under
429    GNULIB_POSIXCHECK for both functions, to remind them that both
430    functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
431    impact on this warning.
432
433    2. The developer is using both modules.  They may be unaware of the
434    arbitrary limitations of fseek, so issue a warning under
435    GNULIB_POSIXCHECK.  On the other hand, they may be using both
436    modules intentionally, so the developer can define
437    _GL_NO_LARGE_FILES in the compilation units where the use of fseek
438    is safe, to silence the warning.
439
440    3. The developer is using the fseeko module, but not fseek.  Gnulib
441    guarantees that fseek will still work around platform bugs in that
442    case, but we presume that the developer is aware of the pitfalls of
443    fseek and was trying to avoid it, so issue a warning even when
444    GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
445    defined to silence the warning in particular compilation units.
446    In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
447    fseek gets defined as a macro, it is recommended that the developer
448    uses the fseek module, even if he is not calling the fseek function.
449
450    Most gnulib clients that perform stream operations should fall into
451    category 3.  */
452
453 #if @GNULIB_FSEEK@
454 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
455 #  define _GL_FSEEK_WARN /* Category 2, above.  */
456 #  undef fseek
457 # endif
458 # if @REPLACE_FSEEK@
459 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
460 #   undef fseek
461 #   define fseek rpl_fseek
462 #  endif
463 _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
464                               _GL_ARG_NONNULL ((1)));
465 _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
466 # else
467 _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
468 # endif
469 _GL_CXXALIASWARN (fseek);
470 #endif
471
472 #if @GNULIB_FSEEKO@
473 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
474 #  define _GL_FSEEK_WARN /* Category 3, above.  */
475 #  undef fseek
476 # endif
477 # if @REPLACE_FSEEKO@
478 /* Provide an fseeko function that is aware of a preceding fflush(), and which
479    detects pipes.  */
480 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
481 #   undef fseeko
482 #   define fseeko rpl_fseeko
483 #  endif
484 _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
485                                _GL_ARG_NONNULL ((1)));
486 _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
487 # else
488 #  if ! @HAVE_DECL_FSEEKO@
489 _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
490                                _GL_ARG_NONNULL ((1)));
491 #  endif
492 _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
493 # endif
494 _GL_CXXALIASWARN (fseeko);
495 #elif defined GNULIB_POSIXCHECK
496 # define _GL_FSEEK_WARN /* Category 1, above.  */
497 # undef fseek
498 # undef fseeko
499 # if HAVE_RAW_DECL_FSEEKO
500 _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
501                  "use gnulib module fseeko for portability");
502 # endif
503 #endif
504
505 #ifdef _GL_FSEEK_WARN
506 # undef _GL_FSEEK_WARN
507 /* Here, either fseek is undefined (but C89 guarantees that it is
508    declared), or it is defined as rpl_fseek (declared above).  */
509 _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
510                  "on 32-bit platforms - "
511                  "use fseeko function for handling of large files");
512 #endif
513
514
515 /* ftell, ftello.  See the comments on fseek/fseeko.  */
516
517 #if @GNULIB_FTELL@
518 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
519 #  define _GL_FTELL_WARN /* Category 2, above.  */
520 #  undef ftell
521 # endif
522 # if @REPLACE_FTELL@
523 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
524 #   undef ftell
525 #   define ftell rpl_ftell
526 #  endif
527 _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
528 _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
529 # else
530 _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
531 # endif
532 _GL_CXXALIASWARN (ftell);
533 #endif
534
535 #if @GNULIB_FTELLO@
536 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
537 #  define _GL_FTELL_WARN /* Category 3, above.  */
538 #  undef ftell
539 # endif
540 # if @REPLACE_FTELLO@
541 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
542 #   undef ftello
543 #   define ftello rpl_ftello
544 #  endif
545 _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
546 _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
547 # else
548 #  if ! @HAVE_DECL_FTELLO@
549 _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
550 #  endif
551 _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
552 # endif
553 _GL_CXXALIASWARN (ftello);
554 #elif defined GNULIB_POSIXCHECK
555 # define _GL_FTELL_WARN /* Category 1, above.  */
556 # undef ftell
557 # undef ftello
558 # if HAVE_RAW_DECL_FTELLO
559 _GL_WARN_ON_USE (ftello, "ftello is unportable - "
560                  "use gnulib module ftello for portability");
561 # endif
562 #endif
563
564 #ifdef _GL_FTELL_WARN
565 # undef _GL_FTELL_WARN
566 /* Here, either ftell is undefined (but C89 guarantees that it is
567    declared), or it is defined as rpl_ftell (declared above).  */
568 _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
569                  "on 32-bit platforms - "
570                  "use ftello function for handling of large files");
571 #endif
572
573
574 #if @GNULIB_FWRITE@
575 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
576 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
577 #   undef fwrite
578 #   define fwrite rpl_fwrite
579 #  endif
580 _GL_FUNCDECL_RPL (fwrite, size_t,
581                   (const void *ptr, size_t s, size_t n, FILE *stream)
582                   _GL_ARG_NONNULL ((1, 4)));
583 _GL_CXXALIAS_RPL (fwrite, size_t,
584                   (const void *ptr, size_t s, size_t n, FILE *stream));
585 # else
586 _GL_CXXALIAS_SYS (fwrite, size_t,
587                   (const void *ptr, size_t s, size_t n, FILE *stream));
588
589 /* Work around bug 11959 when fortifying glibc 2.4 through 2.15
590    <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
591    which sometimes causes an unwanted diagnostic for fwrite calls.
592    This affects only function declaration attributes under certain
593    versions of gcc and clang, and is not needed for C++.  */
594 #  if (0 < __USE_FORTIFY_LEVEL                                          \
595        && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
596        && 3 < __GNUC__ + (4 <= __GNUC_MINOR__)                          \
597        && !defined __cplusplus)
598 #   undef fwrite
599 #   undef fwrite_unlocked
600 extern size_t __REDIRECT (rpl_fwrite,
601                           (const void *__restrict, size_t, size_t,
602                            FILE *__restrict),
603                           fwrite);
604 extern size_t __REDIRECT (rpl_fwrite_unlocked,
605                           (const void *__restrict, size_t, size_t,
606                            FILE *__restrict),
607                           fwrite_unlocked);
608 #   define fwrite rpl_fwrite
609 #   define fwrite_unlocked rpl_fwrite_unlocked
610 #  endif
611 # endif
612 _GL_CXXALIASWARN (fwrite);
613 #endif
614
615 #if @GNULIB_GETC@
616 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
617 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
618 #   undef getc
619 #   define getc rpl_fgetc
620 #  endif
621 _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
622 _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
623 # else
624 _GL_CXXALIAS_SYS (getc, int, (FILE *stream));
625 # endif
626 _GL_CXXALIASWARN (getc);
627 #endif
628
629 #if @GNULIB_GETCHAR@
630 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
631 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
632 #   undef getchar
633 #   define getchar rpl_getchar
634 #  endif
635 _GL_FUNCDECL_RPL (getchar, int, (void));
636 _GL_CXXALIAS_RPL (getchar, int, (void));
637 # else
638 _GL_CXXALIAS_SYS (getchar, int, (void));
639 # endif
640 _GL_CXXALIASWARN (getchar);
641 #endif
642
643 #if @GNULIB_GETDELIM@
644 /* Read input, up to (and including) the next occurrence of DELIMITER, from
645    STREAM, store it in *LINEPTR (and NUL-terminate it).
646    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
647    bytes of space.  It is realloc'd as necessary.
648    Return the number of bytes read and stored at *LINEPTR (not including the
649    NUL terminator), or -1 on error or EOF.  */
650 # if @REPLACE_GETDELIM@
651 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
652 #   undef getdelim
653 #   define getdelim rpl_getdelim
654 #  endif
655 _GL_FUNCDECL_RPL (getdelim, ssize_t,
656                   (char **lineptr, size_t *linesize, int delimiter,
657                    FILE *stream)
658                   _GL_ARG_NONNULL ((1, 2, 4)));
659 _GL_CXXALIAS_RPL (getdelim, ssize_t,
660                   (char **lineptr, size_t *linesize, int delimiter,
661                    FILE *stream));
662 # else
663 #  if !@HAVE_DECL_GETDELIM@
664 _GL_FUNCDECL_SYS (getdelim, ssize_t,
665                   (char **lineptr, size_t *linesize, int delimiter,
666                    FILE *stream)
667                   _GL_ARG_NONNULL ((1, 2, 4)));
668 #  endif
669 _GL_CXXALIAS_SYS (getdelim, ssize_t,
670                   (char **lineptr, size_t *linesize, int delimiter,
671                    FILE *stream));
672 # endif
673 _GL_CXXALIASWARN (getdelim);
674 #elif defined GNULIB_POSIXCHECK
675 # undef getdelim
676 # if HAVE_RAW_DECL_GETDELIM
677 _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
678                  "use gnulib module getdelim for portability");
679 # endif
680 #endif
681
682 #if @GNULIB_GETLINE@
683 /* Read a line, up to (and including) the next newline, from STREAM, store it
684    in *LINEPTR (and NUL-terminate it).
685    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
686    bytes of space.  It is realloc'd as necessary.
687    Return the number of bytes read and stored at *LINEPTR (not including the
688    NUL terminator), or -1 on error or EOF.  */
689 # if @REPLACE_GETLINE@
690 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
691 #   undef getline
692 #   define getline rpl_getline
693 #  endif
694 _GL_FUNCDECL_RPL (getline, ssize_t,
695                   (char **lineptr, size_t *linesize, FILE *stream)
696                   _GL_ARG_NONNULL ((1, 2, 3)));
697 _GL_CXXALIAS_RPL (getline, ssize_t,
698                   (char **lineptr, size_t *linesize, FILE *stream));
699 # else
700 #  if !@HAVE_DECL_GETLINE@
701 _GL_FUNCDECL_SYS (getline, ssize_t,
702                   (char **lineptr, size_t *linesize, FILE *stream)
703                   _GL_ARG_NONNULL ((1, 2, 3)));
704 #  endif
705 _GL_CXXALIAS_SYS (getline, ssize_t,
706                   (char **lineptr, size_t *linesize, FILE *stream));
707 # endif
708 # if @HAVE_DECL_GETLINE@
709 _GL_CXXALIASWARN (getline);
710 # endif
711 #elif defined GNULIB_POSIXCHECK
712 # undef getline
713 # if HAVE_RAW_DECL_GETLINE
714 _GL_WARN_ON_USE (getline, "getline is unportable - "
715                  "use gnulib module getline for portability");
716 # endif
717 #endif
718
719 /* It is very rare that the developer ever has full control of stdin,
720    so any use of gets warrants an unconditional warning; besides, C11
721    removed it.  */
722 #undef gets
723 #if HAVE_RAW_DECL_GETS
724 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
725 #endif
726
727
728 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
729 struct obstack;
730 /* Grow an obstack with formatted output.  Return the number of
731    bytes added to OBS.  No trailing nul byte is added, and the
732    object should be closed with obstack_finish before use.  Upon
733    memory allocation error, call obstack_alloc_failed_handler.  Upon
734    other error, return -1.  */
735 # if @REPLACE_OBSTACK_PRINTF@
736 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
737 #   define obstack_printf rpl_obstack_printf
738 #  endif
739 _GL_FUNCDECL_RPL (obstack_printf, int,
740                   (struct obstack *obs, const char *format, ...)
741                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
742                   _GL_ARG_NONNULL ((1, 2)));
743 _GL_CXXALIAS_RPL (obstack_printf, int,
744                   (struct obstack *obs, const char *format, ...));
745 # else
746 #  if !@HAVE_DECL_OBSTACK_PRINTF@
747 _GL_FUNCDECL_SYS (obstack_printf, int,
748                   (struct obstack *obs, const char *format, ...)
749                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
750                   _GL_ARG_NONNULL ((1, 2)));
751 #  endif
752 _GL_CXXALIAS_SYS (obstack_printf, int,
753                   (struct obstack *obs, const char *format, ...));
754 # endif
755 _GL_CXXALIASWARN (obstack_printf);
756 # if @REPLACE_OBSTACK_PRINTF@
757 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
758 #   define obstack_vprintf rpl_obstack_vprintf
759 #  endif
760 _GL_FUNCDECL_RPL (obstack_vprintf, int,
761                   (struct obstack *obs, const char *format, va_list args)
762                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
763                   _GL_ARG_NONNULL ((1, 2)));
764 _GL_CXXALIAS_RPL (obstack_vprintf, int,
765                   (struct obstack *obs, const char *format, va_list args));
766 # else
767 #  if !@HAVE_DECL_OBSTACK_PRINTF@
768 _GL_FUNCDECL_SYS (obstack_vprintf, int,
769                   (struct obstack *obs, const char *format, va_list args)
770                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
771                   _GL_ARG_NONNULL ((1, 2)));
772 #  endif
773 _GL_CXXALIAS_SYS (obstack_vprintf, int,
774                   (struct obstack *obs, const char *format, va_list args));
775 # endif
776 _GL_CXXALIASWARN (obstack_vprintf);
777 #endif
778
779 #if @GNULIB_PCLOSE@
780 # if !@HAVE_PCLOSE@
781 _GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
782 # endif
783 _GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
784 _GL_CXXALIASWARN (pclose);
785 #elif defined GNULIB_POSIXCHECK
786 # undef pclose
787 # if HAVE_RAW_DECL_PCLOSE
788 _GL_WARN_ON_USE (pclose, "pclose is unportable - "
789                  "use gnulib module pclose for more portability");
790 # endif
791 #endif
792
793 #if @GNULIB_PERROR@
794 /* Print a message to standard error, describing the value of ERRNO,
795    (if STRING is not NULL and not empty) prefixed with STRING and ": ",
796    and terminated with a newline.  */
797 # if @REPLACE_PERROR@
798 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
799 #   define perror rpl_perror
800 #  endif
801 _GL_FUNCDECL_RPL (perror, void, (const char *string));
802 _GL_CXXALIAS_RPL (perror, void, (const char *string));
803 # else
804 _GL_CXXALIAS_SYS (perror, void, (const char *string));
805 # endif
806 _GL_CXXALIASWARN (perror);
807 #elif defined GNULIB_POSIXCHECK
808 # undef perror
809 /* Assume perror is always declared.  */
810 _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
811                  "use gnulib module perror for portability");
812 #endif
813
814 #if @GNULIB_POPEN@
815 # if @REPLACE_POPEN@
816 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
817 #   undef popen
818 #   define popen rpl_popen
819 #  endif
820 _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
821                                  _GL_ARG_NONNULL ((1, 2)));
822 _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
823 # else
824 #  if !@HAVE_POPEN@
825 _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode)
826                                  _GL_ARG_NONNULL ((1, 2)));
827 #  endif
828 _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
829 # endif
830 _GL_CXXALIASWARN (popen);
831 #elif defined GNULIB_POSIXCHECK
832 # undef popen
833 # if HAVE_RAW_DECL_POPEN
834 _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
835                  "use gnulib module popen or pipe for more portability");
836 # endif
837 #endif
838
839 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
840 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
841      || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
842 #  if defined __GNUC__
843 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
844 /* Don't break __attribute__((format(printf,M,N))).  */
845 #    define printf __printf__
846 #   endif
847 #   if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
848 _GL_FUNCDECL_RPL_1 (__printf__, int,
849                     (const char *format, ...)
850                     __asm__ (@ASM_SYMBOL_PREFIX@
851                              _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
852                     _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
853                     _GL_ARG_NONNULL ((1)));
854 #   else
855 _GL_FUNCDECL_RPL_1 (__printf__, int,
856                     (const char *format, ...)
857                     __asm__ (@ASM_SYMBOL_PREFIX@
858                              _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
859                     _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
860                     _GL_ARG_NONNULL ((1)));
861 #   endif
862 _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
863 #  else
864 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
865 #    define printf rpl_printf
866 #   endif
867 _GL_FUNCDECL_RPL (printf, int,
868                   (const char *format, ...)
869                   _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
870                   _GL_ARG_NONNULL ((1)));
871 _GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
872 #  endif
873 #  define GNULIB_overrides_printf 1
874 # else
875 _GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
876 # endif
877 _GL_CXXALIASWARN (printf);
878 #endif
879 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
880 # if !GNULIB_overrides_printf
881 #  undef printf
882 # endif
883 /* Assume printf is always declared.  */
884 _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
885                  "use gnulib module printf-posix for portable "
886                  "POSIX compliance");
887 #endif
888
889 #if @GNULIB_PUTC@
890 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
891 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
892 #   undef putc
893 #   define putc rpl_fputc
894 #  endif
895 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
896 _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
897 # else
898 _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
899 # endif
900 _GL_CXXALIASWARN (putc);
901 #endif
902
903 #if @GNULIB_PUTCHAR@
904 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
905 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
906 #   undef putchar
907 #   define putchar rpl_putchar
908 #  endif
909 _GL_FUNCDECL_RPL (putchar, int, (int c));
910 _GL_CXXALIAS_RPL (putchar, int, (int c));
911 # else
912 _GL_CXXALIAS_SYS (putchar, int, (int c));
913 # endif
914 _GL_CXXALIASWARN (putchar);
915 #endif
916
917 #if @GNULIB_PUTS@
918 # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
919 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
920 #   undef puts
921 #   define puts rpl_puts
922 #  endif
923 _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
924 _GL_CXXALIAS_RPL (puts, int, (const char *string));
925 # else
926 _GL_CXXALIAS_SYS (puts, int, (const char *string));
927 # endif
928 _GL_CXXALIASWARN (puts);
929 #endif
930
931 #if @GNULIB_REMOVE@
932 # if @REPLACE_REMOVE@
933 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
934 #   undef remove
935 #   define remove rpl_remove
936 #  endif
937 _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
938 _GL_CXXALIAS_RPL (remove, int, (const char *name));
939 # else
940 _GL_CXXALIAS_SYS (remove, int, (const char *name));
941 # endif
942 _GL_CXXALIASWARN (remove);
943 #elif defined GNULIB_POSIXCHECK
944 # undef remove
945 /* Assume remove is always declared.  */
946 _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
947                  "use gnulib module remove for more portability");
948 #endif
949
950 #if @GNULIB_RENAME@
951 # if @REPLACE_RENAME@
952 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
953 #   undef rename
954 #   define rename rpl_rename
955 #  endif
956 _GL_FUNCDECL_RPL (rename, int,
957                   (const char *old_filename, const char *new_filename)
958                   _GL_ARG_NONNULL ((1, 2)));
959 _GL_CXXALIAS_RPL (rename, int,
960                   (const char *old_filename, const char *new_filename));
961 # else
962 _GL_CXXALIAS_SYS (rename, int,
963                   (const char *old_filename, const char *new_filename));
964 # endif
965 _GL_CXXALIASWARN (rename);
966 #elif defined GNULIB_POSIXCHECK
967 # undef rename
968 /* Assume rename is always declared.  */
969 _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
970                  "use gnulib module rename for more portability");
971 #endif
972
973 #if @GNULIB_RENAMEAT@
974 # if @REPLACE_RENAMEAT@
975 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
976 #   undef renameat
977 #   define renameat rpl_renameat
978 #  endif
979 _GL_FUNCDECL_RPL (renameat, int,
980                   (int fd1, char const *file1, int fd2, char const *file2)
981                   _GL_ARG_NONNULL ((2, 4)));
982 _GL_CXXALIAS_RPL (renameat, int,
983                   (int fd1, char const *file1, int fd2, char const *file2));
984 # else
985 #  if !@HAVE_RENAMEAT@
986 _GL_FUNCDECL_SYS (renameat, int,
987                   (int fd1, char const *file1, int fd2, char const *file2)
988                   _GL_ARG_NONNULL ((2, 4)));
989 #  endif
990 _GL_CXXALIAS_SYS (renameat, int,
991                   (int fd1, char const *file1, int fd2, char const *file2));
992 # endif
993 _GL_CXXALIASWARN (renameat);
994 #elif defined GNULIB_POSIXCHECK
995 # undef renameat
996 # if HAVE_RAW_DECL_RENAMEAT
997 _GL_WARN_ON_USE (renameat, "renameat is not portable - "
998                  "use gnulib module renameat for portability");
999 # endif
1000 #endif
1001
1002 #if @GNULIB_SCANF@
1003 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1004 #  if defined __GNUC__
1005 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1006 #    undef scanf
1007 /* Don't break __attribute__((format(scanf,M,N))).  */
1008 #    define scanf __scanf__
1009 #   endif
1010 _GL_FUNCDECL_RPL_1 (__scanf__, int,
1011                     (const char *format, ...)
1012                     __asm__ (@ASM_SYMBOL_PREFIX@
1013                              _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
1014                     _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1015                     _GL_ARG_NONNULL ((1)));
1016 _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
1017 #  else
1018 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1019 #    undef scanf
1020 #    define scanf rpl_scanf
1021 #   endif
1022 _GL_FUNCDECL_RPL (scanf, int, (const char *format, ...)
1023                               _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1024                               _GL_ARG_NONNULL ((1)));
1025 _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
1026 #  endif
1027 # else
1028 _GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
1029 # endif
1030 _GL_CXXALIASWARN (scanf);
1031 #endif
1032
1033 #if @GNULIB_SNPRINTF@
1034 # if @REPLACE_SNPRINTF@
1035 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1036 #   define snprintf rpl_snprintf
1037 #  endif
1038 _GL_FUNCDECL_RPL (snprintf, int,
1039                   (char *str, size_t size, const char *format, ...)
1040                   _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
1041                   _GL_ARG_NONNULL ((3)));
1042 _GL_CXXALIAS_RPL (snprintf, int,
1043                   (char *str, size_t size, const char *format, ...));
1044 # else
1045 #  if !@HAVE_DECL_SNPRINTF@
1046 _GL_FUNCDECL_SYS (snprintf, int,
1047                   (char *str, size_t size, const char *format, ...)
1048                   _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
1049                   _GL_ARG_NONNULL ((3)));
1050 #  endif
1051 _GL_CXXALIAS_SYS (snprintf, int,
1052                   (char *str, size_t size, const char *format, ...));
1053 # endif
1054 _GL_CXXALIASWARN (snprintf);
1055 #elif defined GNULIB_POSIXCHECK
1056 # undef snprintf
1057 # if HAVE_RAW_DECL_SNPRINTF
1058 _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1059                  "use gnulib module snprintf for portability");
1060 # endif
1061 #endif
1062
1063 /* Some people would argue that all sprintf uses should be warned about
1064    (for example, OpenBSD issues a link warning for it),
1065    since it can cause security holes due to buffer overruns.
1066    However, we believe that sprintf can be used safely, and is more
1067    efficient than snprintf in those safe cases; and as proof of our
1068    belief, we use sprintf in several gnulib modules.  So this header
1069    intentionally avoids adding a warning to sprintf except when
1070    GNULIB_POSIXCHECK is defined.  */
1071
1072 #if @GNULIB_SPRINTF_POSIX@
1073 # if @REPLACE_SPRINTF@
1074 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1075 #   define sprintf rpl_sprintf
1076 #  endif
1077 _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
1078                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1079                                 _GL_ARG_NONNULL ((1, 2)));
1080 _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
1081 # else
1082 _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
1083 # endif
1084 _GL_CXXALIASWARN (sprintf);
1085 #elif defined GNULIB_POSIXCHECK
1086 # undef sprintf
1087 /* Assume sprintf is always declared.  */
1088 _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
1089                  "use gnulib module sprintf-posix for portable "
1090                  "POSIX compliance");
1091 #endif
1092
1093 #if @GNULIB_TMPFILE@
1094 # if @REPLACE_TMPFILE@
1095 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1096 #   define tmpfile rpl_tmpfile
1097 #  endif
1098 _GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
1099 _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1100 # else
1101 _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1102 # endif
1103 _GL_CXXALIASWARN (tmpfile);
1104 #elif defined GNULIB_POSIXCHECK
1105 # undef tmpfile
1106 # if HAVE_RAW_DECL_TMPFILE
1107 _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1108                  "use gnulib module tmpfile for portability");
1109 # endif
1110 #endif
1111
1112 #if @GNULIB_VASPRINTF@
1113 /* Write formatted output to a string dynamically allocated with malloc().
1114    If the memory allocation succeeds, store the address of the string in
1115    *RESULT and return the number of resulting bytes, excluding the trailing
1116    NUL.  Upon memory allocation error, or some other error, return -1.  */
1117 # if @REPLACE_VASPRINTF@
1118 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1119 #   define asprintf rpl_asprintf
1120 #  endif
1121 _GL_FUNCDECL_RPL (asprintf, int,
1122                   (char **result, const char *format, ...)
1123                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1124                   _GL_ARG_NONNULL ((1, 2)));
1125 _GL_CXXALIAS_RPL (asprintf, int,
1126                   (char **result, const char *format, ...));
1127 # else
1128 #  if !@HAVE_VASPRINTF@
1129 _GL_FUNCDECL_SYS (asprintf, int,
1130                   (char **result, const char *format, ...)
1131                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
1132                   _GL_ARG_NONNULL ((1, 2)));
1133 #  endif
1134 _GL_CXXALIAS_SYS (asprintf, int,
1135                   (char **result, const char *format, ...));
1136 # endif
1137 _GL_CXXALIASWARN (asprintf);
1138 # if @REPLACE_VASPRINTF@
1139 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1140 #   define vasprintf rpl_vasprintf
1141 #  endif
1142 _GL_FUNCDECL_RPL (vasprintf, int,
1143                   (char **result, const char *format, va_list args)
1144                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1145                   _GL_ARG_NONNULL ((1, 2)));
1146 _GL_CXXALIAS_RPL (vasprintf, int,
1147                   (char **result, const char *format, va_list args));
1148 # else
1149 #  if !@HAVE_VASPRINTF@
1150 _GL_FUNCDECL_SYS (vasprintf, int,
1151                   (char **result, const char *format, va_list args)
1152                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1153                   _GL_ARG_NONNULL ((1, 2)));
1154 #  endif
1155 _GL_CXXALIAS_SYS (vasprintf, int,
1156                   (char **result, const char *format, va_list args));
1157 # endif
1158 _GL_CXXALIASWARN (vasprintf);
1159 #endif
1160
1161 #if @GNULIB_VDPRINTF@
1162 # if @REPLACE_VDPRINTF@
1163 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1164 #   define vdprintf rpl_vdprintf
1165 #  endif
1166 _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
1167                                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1168                                  _GL_ARG_NONNULL ((2)));
1169 _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
1170 # else
1171 #  if !@HAVE_VDPRINTF@
1172 _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
1173                                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1174                                  _GL_ARG_NONNULL ((2)));
1175 #  endif
1176 /* Need to cast, because on Solaris, the third parameter will likely be
1177                                                     __va_list args.  */
1178 _GL_CXXALIAS_SYS_CAST (vdprintf, int,
1179                        (int fd, const char *format, va_list args));
1180 # endif
1181 _GL_CXXALIASWARN (vdprintf);
1182 #elif defined GNULIB_POSIXCHECK
1183 # undef vdprintf
1184 # if HAVE_RAW_DECL_VDPRINTF
1185 _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1186                  "use gnulib module vdprintf for portability");
1187 # endif
1188 #endif
1189
1190 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1191 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1192      || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1193 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1194 #   define vfprintf rpl_vfprintf
1195 #  endif
1196 #  define GNULIB_overrides_vfprintf 1
1197 #  if @GNULIB_VFPRINTF_POSIX@
1198 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
1199                                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1200                                  _GL_ARG_NONNULL ((1, 2)));
1201 #  else
1202 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
1203                                  _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1204                                  _GL_ARG_NONNULL ((1, 2)));
1205 #  endif
1206 _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
1207 # else
1208 /* Need to cast, because on Solaris, the third parameter is
1209                                                       __va_list args
1210    and GCC's fixincludes did not change this to __gnuc_va_list.  */
1211 _GL_CXXALIAS_SYS_CAST (vfprintf, int,
1212                        (FILE *fp, const char *format, va_list args));
1213 # endif
1214 _GL_CXXALIASWARN (vfprintf);
1215 #endif
1216 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1217 # if !GNULIB_overrides_vfprintf
1218 #  undef vfprintf
1219 # endif
1220 /* Assume vfprintf is always declared.  */
1221 _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1222                  "use gnulib module vfprintf-posix for portable "
1223                       "POSIX compliance");
1224 #endif
1225
1226 #if @GNULIB_VFSCANF@
1227 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1228 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1229 #   undef vfscanf
1230 #   define vfscanf rpl_vfscanf
1231 #  endif
1232 _GL_FUNCDECL_RPL (vfscanf, int,
1233                   (FILE *stream, const char *format, va_list args)
1234                   _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1235                   _GL_ARG_NONNULL ((1, 2)));
1236 _GL_CXXALIAS_RPL (vfscanf, int,
1237                   (FILE *stream, const char *format, va_list args));
1238 # else
1239 _GL_CXXALIAS_SYS (vfscanf, int,
1240                   (FILE *stream, const char *format, va_list args));
1241 # endif
1242 _GL_CXXALIASWARN (vfscanf);
1243 #endif
1244
1245 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1246 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1247      || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1248 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1249 #   define vprintf rpl_vprintf
1250 #  endif
1251 #  define GNULIB_overrides_vprintf 1
1252 #  if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1253 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
1254                                 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
1255                                 _GL_ARG_NONNULL ((1)));
1256 #  else
1257 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
1258                                 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1259                                 _GL_ARG_NONNULL ((1)));
1260 #  endif
1261 _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
1262 # else
1263 /* Need to cast, because on Solaris, the second parameter is
1264                                                           __va_list args
1265    and GCC's fixincludes did not change this to __gnuc_va_list.  */
1266 _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
1267 # endif
1268 _GL_CXXALIASWARN (vprintf);
1269 #endif
1270 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1271 # if !GNULIB_overrides_vprintf
1272 #  undef vprintf
1273 # endif
1274 /* Assume vprintf is always declared.  */
1275 _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1276                  "use gnulib module vprintf-posix for portable "
1277                  "POSIX compliance");
1278 #endif
1279
1280 #if @GNULIB_VSCANF@
1281 # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
1282 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1283 #   undef vscanf
1284 #   define vscanf rpl_vscanf
1285 #  endif
1286 _GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args)
1287                                _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1288                                _GL_ARG_NONNULL ((1)));
1289 _GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
1290 # else
1291 _GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
1292 # endif
1293 _GL_CXXALIASWARN (vscanf);
1294 #endif
1295
1296 #if @GNULIB_VSNPRINTF@
1297 # if @REPLACE_VSNPRINTF@
1298 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1299 #   define vsnprintf rpl_vsnprintf
1300 #  endif
1301 _GL_FUNCDECL_RPL (vsnprintf, int,
1302                   (char *str, size_t size, const char *format, va_list args)
1303                   _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1304                   _GL_ARG_NONNULL ((3)));
1305 _GL_CXXALIAS_RPL (vsnprintf, int,
1306                   (char *str, size_t size, const char *format, va_list args));
1307 # else
1308 #  if !@HAVE_DECL_VSNPRINTF@
1309 _GL_FUNCDECL_SYS (vsnprintf, int,
1310                   (char *str, size_t size, const char *format, va_list args)
1311                   _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
1312                   _GL_ARG_NONNULL ((3)));
1313 #  endif
1314 _GL_CXXALIAS_SYS (vsnprintf, int,
1315                   (char *str, size_t size, const char *format, va_list args));
1316 # endif
1317 _GL_CXXALIASWARN (vsnprintf);
1318 #elif defined GNULIB_POSIXCHECK
1319 # undef vsnprintf
1320 # if HAVE_RAW_DECL_VSNPRINTF
1321 _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1322                  "use gnulib module vsnprintf for portability");
1323 # endif
1324 #endif
1325
1326 #if @GNULIB_VSPRINTF_POSIX@
1327 # if @REPLACE_VSPRINTF@
1328 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1329 #   define vsprintf rpl_vsprintf
1330 #  endif
1331 _GL_FUNCDECL_RPL (vsprintf, int,
1332                   (char *str, const char *format, va_list args)
1333                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
1334                   _GL_ARG_NONNULL ((1, 2)));
1335 _GL_CXXALIAS_RPL (vsprintf, int,
1336                   (char *str, const char *format, va_list args));
1337 # else
1338 /* Need to cast, because on Solaris, the third parameter is
1339                                                        __va_list args
1340    and GCC's fixincludes did not change this to __gnuc_va_list.  */
1341 _GL_CXXALIAS_SYS_CAST (vsprintf, int,
1342                        (char *str, const char *format, va_list args));
1343 # endif
1344 _GL_CXXALIASWARN (vsprintf);
1345 #elif defined GNULIB_POSIXCHECK
1346 # undef vsprintf
1347 /* Assume vsprintf is always declared.  */
1348 _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
1349                  "use gnulib module vsprintf-posix for portable "
1350                       "POSIX compliance");
1351 #endif
1352
1353 #endif /* _@GUARD_PREFIX@_STDIO_H */
1354 #endif /* _@GUARD_PREFIX@_STDIO_H */
1355 #endif