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