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