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