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