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