1/* This file is automatically generated. DO NOT EDIT! */ 2/* Generated from: NetBSD: mknative-gdb,v 1.16 2023/07/31 17:09:59 christos Exp */ 3/* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp */ 4 5/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 6/* A GNU-like <stdio.h>. 7 8 Copyright (C) 2004, 2007-2022 Free Software Foundation, Inc. 9 10 This file is free software: you can redistribute it and/or modify 11 it under the terms of the GNU Lesser General Public License as 12 published by the Free Software Foundation; either version 2.1 of the 13 License, or (at your option) any later version. 14 15 This file is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU Lesser General Public License for more details. 19 20 You should have received a copy of the GNU Lesser General Public License 21 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 22 23#if __GNUC__ >= 3 24#pragma GCC system_header 25#endif 26 27 28#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H 29/* Special invocation convention: 30 - Inside glibc header files. 31 - On OSF/1 5.1 we have a sequence of nested includes 32 <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> -> 33 <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>. 34 In this situation, the functions are not yet declared, therefore we cannot 35 provide the C++ aliases. */ 36 37#include_next <stdio.h> 38 39#else 40/* Normal invocation convention. */ 41 42#ifndef _GL_STDIO_H 43 44#define _GL_ALREADY_INCLUDING_STDIO_H 45 46/* The include_next requires a split double-inclusion guard. */ 47#include_next <stdio.h> 48 49#undef _GL_ALREADY_INCLUDING_STDIO_H 50 51#ifndef _GL_STDIO_H 52#define _GL_STDIO_H 53 54/* Get va_list. Needed on many systems, including glibc 2.8. */ 55#include <stdarg.h> 56 57#include <stddef.h> 58 59/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 60 and eglibc 2.11.2. 61 May also define off_t to a 64-bit type on native Windows. */ 62#include <sys/types.h> 63 64/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ 65/* But in any case avoid namespace pollution on glibc systems. */ 66#if (0 || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ 67 && ! defined __GLIBC__ 68# include <unistd.h> 69#endif 70 71/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */ 72/* But in any case avoid namespace pollution on glibc systems. */ 73#if (0 || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ 74 && ! defined __GLIBC__ 75# include <sys/stat.h> 76#endif 77 78/* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include 79 it before we #define perror rpl_perror. */ 80/* But in any case avoid namespace pollution on glibc systems. */ 81#if (0 || defined GNULIB_POSIXCHECK) \ 82 && (defined _WIN32 && ! defined __CYGWIN__) \ 83 && ! defined __GLIBC__ 84# include <stdlib.h> 85#endif 86 87/* MSVC declares 'remove' in <io.h>, not in <stdio.h>. We must include 88 it before we #define remove rpl_remove. */ 89/* MSVC declares 'rename' in <io.h>, not in <stdio.h>. We must include 90 it before we #define rename rpl_rename. */ 91/* But in any case avoid namespace pollution on glibc systems. */ 92#if (0 || 1 || defined GNULIB_POSIXCHECK) \ 93 && (defined _WIN32 && ! defined __CYGWIN__) \ 94 && ! defined __GLIBC__ 95# include <io.h> 96#endif 97 98 99/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers 100 that can be freed by passing them as the Ith argument to the 101 function F. */ 102#ifndef _GL_ATTRIBUTE_DEALLOC 103# if __GNUC__ >= 11 104# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 105# else 106# define _GL_ATTRIBUTE_DEALLOC(f, i) 107# endif 108#endif 109 110/* The __attribute__ feature is available in gcc versions 2.5 and later. 111 The __-protected variants of the attributes 'format' and 'printf' are 112 accepted by gcc versions 2.6.4 (effectively 2.7) and later. 113 We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because 114 gnulib and libintl do '#define printf __printf__' when they override 115 the 'printf' function. */ 116#ifndef _GL_ATTRIBUTE_FORMAT 117# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__ 118# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) 119# else 120# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ 121# endif 122#endif 123 124/* An __attribute__ __format__ specifier for a function that takes a format 125 string and arguments, where the format string directives are the ones 126 standardized by ISO C99 and POSIX. 127 _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */ 128/* __gnu_printf__ is supported in GCC >= 4.4. */ 129#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) 130# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__ 131#else 132# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__ 133#endif 134 135/* An __attribute__ __format__ specifier for a function that takes a format 136 string and arguments, where the format string directives are the ones of the 137 system printf(), rather than the ones standardized by ISO C99 and POSIX. 138 _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM */ 139/* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to 140 the standards. The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates 141 whether this change is effective. On older mingw, it is not. */ 142#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 143# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD 144#else 145# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__ 146#endif 147 148/* _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD 149 indicates to GCC that the function takes a format string and arguments, 150 where the format string directives are the ones standardized by ISO C99 151 and POSIX. */ 152#define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \ 153 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument)) 154 155/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD, 156 except that it indicates to GCC that the supported format string directives 157 are the ones of the system printf(), rather than the ones standardized by 158 ISO C99 and POSIX. */ 159#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ 160 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, formatstring_parameter, first_argument)) 161 162/* _GL_ATTRIBUTE_FORMAT_SCANF 163 indicates to GCC that the function takes a format string and arguments, 164 where the format string directives are the ones standardized by ISO C99 165 and POSIX. */ 166#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) 167# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ 168 _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) 169#else 170# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ 171 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) 172#endif 173 174/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, 175 except that it indicates to GCC that the supported format string directives 176 are the ones of the system scanf(), rather than the ones standardized by 177 ISO C99 and POSIX. */ 178#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ 179 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) 180 181/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 182/* C++ compatible function declaration macros. 183 Copyright (C) 2010-2022 Free Software Foundation, Inc. 184 185 This program is free software: you can redistribute it and/or modify it 186 under the terms of the GNU Lesser General Public License as published 187 by the Free Software Foundation; either version 2 of the License, or 188 (at your option) any later version. 189 190 This program is distributed in the hope that it will be useful, 191 but WITHOUT ANY WARRANTY; without even the implied warranty of 192 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 193 Lesser General Public License for more details. 194 195 You should have received a copy of the GNU Lesser General Public License 196 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 197 198#ifndef _GL_CXXDEFS_H 199#define _GL_CXXDEFS_H 200 201/* Begin/end the GNULIB_NAMESPACE namespace. */ 202#if defined __cplusplus && defined GNULIB_NAMESPACE 203# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 204# define _GL_END_NAMESPACE } 205#else 206# define _GL_BEGIN_NAMESPACE 207# define _GL_END_NAMESPACE 208#endif 209 210/* The three most frequent use cases of these macros are: 211 212 * For providing a substitute for a function that is missing on some 213 platforms, but is declared and works fine on the platforms on which 214 it exists: 215 216 #if @GNULIB_FOO@ 217 # if !@HAVE_FOO@ 218 _GL_FUNCDECL_SYS (foo, ...); 219 # endif 220 _GL_CXXALIAS_SYS (foo, ...); 221 _GL_CXXALIASWARN (foo); 222 #elif defined GNULIB_POSIXCHECK 223 ... 224 #endif 225 226 * For providing a replacement for a function that exists on all platforms, 227 but is broken/insufficient and needs to be replaced on some platforms: 228 229 #if @GNULIB_FOO@ 230 # if @REPLACE_FOO@ 231 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 232 # undef foo 233 # define foo rpl_foo 234 # endif 235 _GL_FUNCDECL_RPL (foo, ...); 236 _GL_CXXALIAS_RPL (foo, ...); 237 # else 238 _GL_CXXALIAS_SYS (foo, ...); 239 # endif 240 _GL_CXXALIASWARN (foo); 241 #elif defined GNULIB_POSIXCHECK 242 ... 243 #endif 244 245 * For providing a replacement for a function that exists on some platforms 246 but is broken/insufficient and needs to be replaced on some of them and 247 is additionally either missing or undeclared on some other platforms: 248 249 #if @GNULIB_FOO@ 250 # if @REPLACE_FOO@ 251 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 252 # undef foo 253 # define foo rpl_foo 254 # endif 255 _GL_FUNCDECL_RPL (foo, ...); 256 _GL_CXXALIAS_RPL (foo, ...); 257 # else 258 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 259 _GL_FUNCDECL_SYS (foo, ...); 260 # endif 261 _GL_CXXALIAS_SYS (foo, ...); 262 # endif 263 _GL_CXXALIASWARN (foo); 264 #elif defined GNULIB_POSIXCHECK 265 ... 266 #endif 267*/ 268 269/* _GL_EXTERN_C declaration; 270 performs the declaration with C linkage. */ 271#if defined __cplusplus 272# define _GL_EXTERN_C extern "C" 273#else 274# define _GL_EXTERN_C extern 275#endif 276 277/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 278 declares a replacement function, named rpl_func, with the given prototype, 279 consisting of return type, parameters, and attributes. 280 Example: 281 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 282 _GL_ARG_NONNULL ((1))); 283 */ 284#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 285 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 286#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 287 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 288 289/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 290 declares the system function, named func, with the given prototype, 291 consisting of return type, parameters, and attributes. 292 Example: 293 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 294 _GL_ARG_NONNULL ((1))); 295 */ 296#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 297 _GL_EXTERN_C rettype func parameters_and_attributes 298 299/* _GL_CXXALIAS_RPL (func, rettype, parameters); 300 declares a C++ alias called GNULIB_NAMESPACE::func 301 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 302 Example: 303 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 304 305 Wrapping rpl_func in an object with an inline conversion operator 306 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 307 actually used in the program. */ 308#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 309 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 310#if defined __cplusplus && defined GNULIB_NAMESPACE 311# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 312 namespace GNULIB_NAMESPACE \ 313 { \ 314 static const struct _gl_ ## func ## _wrapper \ 315 { \ 316 typedef rettype (*type) parameters; \ 317 \ 318 inline operator type () const \ 319 { \ 320 return ::rpl_func; \ 321 } \ 322 } func = {}; \ 323 } \ 324 _GL_EXTERN_C int _gl_cxxalias_dummy 325#else 326# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 327 _GL_EXTERN_C int _gl_cxxalias_dummy 328#endif 329 330/* _GL_CXXALIAS_MDA (func, rettype, parameters); 331 is to be used when func is a Microsoft deprecated alias, on native Windows. 332 It declares a C++ alias called GNULIB_NAMESPACE::func 333 that redirects to _func, if GNULIB_NAMESPACE is defined. 334 Example: 335 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); 336 */ 337#define _GL_CXXALIAS_MDA(func,rettype,parameters) \ 338 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) 339 340/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 341 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 342 except that the C function rpl_func may have a slightly different 343 declaration. A cast is used to silence the "invalid conversion" error 344 that would otherwise occur. */ 345#if defined __cplusplus && defined GNULIB_NAMESPACE 346# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 347 namespace GNULIB_NAMESPACE \ 348 { \ 349 static const struct _gl_ ## func ## _wrapper \ 350 { \ 351 typedef rettype (*type) parameters; \ 352 \ 353 inline operator type () const \ 354 { \ 355 return reinterpret_cast<type>(::rpl_func); \ 356 } \ 357 } func = {}; \ 358 } \ 359 _GL_EXTERN_C int _gl_cxxalias_dummy 360#else 361# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 362 _GL_EXTERN_C int _gl_cxxalias_dummy 363#endif 364 365/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); 366 is like _GL_CXXALIAS_MDA (func, rettype, parameters); 367 except that the C function func may have a slightly different declaration. 368 A cast is used to silence the "invalid conversion" error that would 369 otherwise occur. */ 370#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ 371 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) 372 373/* _GL_CXXALIAS_SYS (func, rettype, parameters); 374 declares a C++ alias called GNULIB_NAMESPACE::func 375 that redirects to the system provided function func, if GNULIB_NAMESPACE 376 is defined. 377 Example: 378 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 379 380 Wrapping func in an object with an inline conversion operator 381 avoids a reference to func unless GNULIB_NAMESPACE::func is 382 actually used in the program. */ 383#if defined __cplusplus && defined GNULIB_NAMESPACE 384# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 385 namespace GNULIB_NAMESPACE \ 386 { \ 387 static const struct _gl_ ## func ## _wrapper \ 388 { \ 389 typedef rettype (*type) parameters; \ 390 \ 391 inline operator type () const \ 392 { \ 393 return ::func; \ 394 } \ 395 } func = {}; \ 396 } \ 397 _GL_EXTERN_C int _gl_cxxalias_dummy 398#else 399# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 400 _GL_EXTERN_C int _gl_cxxalias_dummy 401#endif 402 403/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 404 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 405 except that the C function func may have a slightly different declaration. 406 A cast is used to silence the "invalid conversion" error that would 407 otherwise occur. */ 408#if defined __cplusplus && defined GNULIB_NAMESPACE 409# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 410 namespace GNULIB_NAMESPACE \ 411 { \ 412 static const struct _gl_ ## func ## _wrapper \ 413 { \ 414 typedef rettype (*type) parameters; \ 415 \ 416 inline operator type () const \ 417 { \ 418 return reinterpret_cast<type>(::func); \ 419 } \ 420 } func = {}; \ 421 } \ 422 _GL_EXTERN_C int _gl_cxxalias_dummy 423#else 424# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 425 _GL_EXTERN_C int _gl_cxxalias_dummy 426#endif 427 428/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 429 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 430 except that the C function is picked among a set of overloaded functions, 431 namely the one with rettype2 and parameters2. Two consecutive casts 432 are used to silence the "cannot find a match" and "invalid conversion" 433 errors that would otherwise occur. */ 434#if defined __cplusplus && defined GNULIB_NAMESPACE 435 /* The outer cast must be a reinterpret_cast. 436 The inner cast: When the function is defined as a set of overloaded 437 functions, it works as a static_cast<>, choosing the designated variant. 438 When the function is defined as a single variant, it works as a 439 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 440# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 441 namespace GNULIB_NAMESPACE \ 442 { \ 443 static const struct _gl_ ## func ## _wrapper \ 444 { \ 445 typedef rettype (*type) parameters; \ 446 \ 447 inline operator type () const \ 448 { \ 449 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 450 } \ 451 } func = {}; \ 452 } \ 453 _GL_EXTERN_C int _gl_cxxalias_dummy 454#else 455# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 456 _GL_EXTERN_C int _gl_cxxalias_dummy 457#endif 458 459/* _GL_CXXALIASWARN (func); 460 causes a warning to be emitted when ::func is used but not when 461 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 462 variants. */ 463#if defined __cplusplus && defined GNULIB_NAMESPACE 464# define _GL_CXXALIASWARN(func) \ 465 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 466# define _GL_CXXALIASWARN_1(func,namespace) \ 467 _GL_CXXALIASWARN_2 (func, namespace) 468/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 469 we enable the warning only when not optimizing. */ 470# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) 471# define _GL_CXXALIASWARN_2(func,namespace) \ 472 _GL_WARN_ON_USE (func, \ 473 "The symbol ::" #func " refers to the system function. " \ 474 "Use " #namespace "::" #func " instead.") 475# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 476# define _GL_CXXALIASWARN_2(func,namespace) \ 477 extern __typeof__ (func) func 478# else 479# define _GL_CXXALIASWARN_2(func,namespace) \ 480 _GL_EXTERN_C int _gl_cxxalias_dummy 481# endif 482#else 483# define _GL_CXXALIASWARN(func) \ 484 _GL_EXTERN_C int _gl_cxxalias_dummy 485#endif 486 487/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 488 causes a warning to be emitted when the given overloaded variant of ::func 489 is used but not when GNULIB_NAMESPACE::func is used. */ 490#if defined __cplusplus && defined GNULIB_NAMESPACE 491# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 492 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 493 GNULIB_NAMESPACE) 494# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 495 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 496/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 497 we enable the warning only when not optimizing. */ 498# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) 499# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 500 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ 501 "The symbol ::" #func " refers to the system function. " \ 502 "Use " #namespace "::" #func " instead.") 503# else 504# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 505 _GL_EXTERN_C int _gl_cxxalias_dummy 506# endif 507#else 508# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 509 _GL_EXTERN_C int _gl_cxxalias_dummy 510#endif 511 512#endif /* _GL_CXXDEFS_H */ 513 514/* The definition of _GL_ARG_NONNULL is copied here. */ 515/* A C macro for declaring that specific arguments must not be NULL. 516 Copyright (C) 2009-2022 Free Software Foundation, Inc. 517 518 This program is free software: you can redistribute it and/or modify it 519 under the terms of the GNU Lesser General Public License as published 520 by the Free Software Foundation; either version 2 of the License, or 521 (at your option) any later version. 522 523 This program is distributed in the hope that it will be useful, 524 but WITHOUT ANY WARRANTY; without even the implied warranty of 525 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 526 Lesser General Public License for more details. 527 528 You should have received a copy of the GNU Lesser General Public License 529 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 530 531/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 532 that the values passed as arguments n, ..., m must be non-NULL pointers. 533 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 534#ifndef _GL_ARG_NONNULL 535# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ 536# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 537# else 538# define _GL_ARG_NONNULL(params) 539# endif 540#endif 541 542/* The definition of _GL_WARN_ON_USE is copied here. */ 543/* A C macro for emitting warnings if a function is used. 544 Copyright (C) 2010-2022 Free Software Foundation, Inc. 545 546 This program is free software: you can redistribute it and/or modify it 547 under the terms of the GNU Lesser General Public License as published 548 by the Free Software Foundation; either version 2 of the License, or 549 (at your option) any later version. 550 551 This program is distributed in the hope that it will be useful, 552 but WITHOUT ANY WARRANTY; without even the implied warranty of 553 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 554 Lesser General Public License for more details. 555 556 You should have received a copy of the GNU Lesser General Public License 557 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 558 559/* _GL_WARN_ON_USE (function, "literal string") issues a declaration 560 for FUNCTION which will then trigger a compiler warning containing 561 the text of "literal string" anywhere that function is called, if 562 supported by the compiler. If the compiler does not support this 563 feature, the macro expands to an unused extern declaration. 564 565 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 566 attribute used in _GL_WARN_ON_USE. If the compiler does not support 567 this feature, it expands to empty. 568 569 These macros are useful for marking a function as a potential 570 portability trap, with the intent that "literal string" include 571 instructions on the replacement function that should be used 572 instead. 573 _GL_WARN_ON_USE is for functions with 'extern' linkage. 574 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 575 linkage. 576 577 However, one of the reasons that a function is a portability trap is 578 if it has the wrong signature. Declaring FUNCTION with a different 579 signature in C is a compilation error, so this macro must use the 580 same type as any existing declaration so that programs that avoid 581 the problematic FUNCTION do not fail to compile merely because they 582 included a header that poisoned the function. But this implies that 583 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 584 have a declaration. Use of this macro implies that there must not 585 be any other macro hiding the declaration of FUNCTION; but 586 undefining FUNCTION first is part of the poisoning process anyway 587 (although for symbols that are provided only via a macro, the result 588 is a compilation error rather than a warning containing 589 "literal string"). Also note that in C++, it is only safe to use if 590 FUNCTION has no overloads. 591 592 For an example, it is possible to poison 'getline' by: 593 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 594 [getline]) in configure.ac, which potentially defines 595 HAVE_RAW_DECL_GETLINE 596 - adding this code to a header that wraps the system <stdio.h>: 597 #undef getline 598 #if HAVE_RAW_DECL_GETLINE 599 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 600 "not universally present; use the gnulib module getline"); 601 #endif 602 603 It is not possible to directly poison global variables. But it is 604 possible to write a wrapper accessor function, and poison that 605 (less common usage, like &environ, will cause a compilation error 606 rather than issue the nice warning, but the end result of informing 607 the developer about their portability problem is still achieved): 608 #if HAVE_RAW_DECL_ENVIRON 609 static char *** 610 rpl_environ (void) { return &environ; } 611 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 612 # undef environ 613 # define environ (*rpl_environ ()) 614 #endif 615 or better (avoiding contradictory use of 'static' and 'extern'): 616 #if HAVE_RAW_DECL_ENVIRON 617 static char *** 618 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 619 rpl_environ (void) { return &environ; } 620 # undef environ 621 # define environ (*rpl_environ ()) 622 #endif 623 */ 624#ifndef _GL_WARN_ON_USE 625 626# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 627/* A compiler attribute is available in gcc versions 4.3.0 and later. */ 628# define _GL_WARN_ON_USE(function, message) \ 629_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) 630# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 631 __attribute__ ((__warning__ (message))) 632# elif __clang_major__ >= 4 633/* Another compiler attribute is available in clang. */ 634# define _GL_WARN_ON_USE(function, message) \ 635_GL_WARN_EXTERN_C __typeof__ (function) function \ 636 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 637# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 638 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 639# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 640/* Verify the existence of the function. */ 641# define _GL_WARN_ON_USE(function, message) \ 642_GL_WARN_EXTERN_C __typeof__ (function) function 643# define _GL_WARN_ON_USE_ATTRIBUTE(message) 644# else /* Unsupported. */ 645# define _GL_WARN_ON_USE(function, message) \ 646_GL_WARN_EXTERN_C int _gl_warn_on_use 647# define _GL_WARN_ON_USE_ATTRIBUTE(message) 648# endif 649#endif 650 651/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") 652 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the 653 function is declared with the given prototype, consisting of return type, 654 parameters, and attributes. 655 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 656 not work in this case. */ 657#ifndef _GL_WARN_ON_USE_CXX 658# if !defined __cplusplus 659# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 660 _GL_WARN_ON_USE (function, msg) 661# else 662# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 663/* A compiler attribute is available in gcc versions 4.3.0 and later. */ 664# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 665extern rettype_gcc function parameters_and_attributes \ 666 __attribute__ ((__warning__ (msg))) 667# elif __clang_major__ >= 4 668/* Another compiler attribute is available in clang. */ 669# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 670extern rettype_clang function parameters_and_attributes \ 671 __attribute__ ((__diagnose_if__ (1, msg, "warning"))) 672# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 673/* Verify the existence of the function. */ 674# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 675extern rettype_gcc function parameters_and_attributes 676# else /* Unsupported. */ 677# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 678_GL_WARN_EXTERN_C int _gl_warn_on_use 679# endif 680# endif 681#endif 682 683/* _GL_WARN_EXTERN_C declaration; 684 performs the declaration with C linkage. */ 685#ifndef _GL_WARN_EXTERN_C 686# if defined __cplusplus 687# define _GL_WARN_EXTERN_C extern "C" 688# else 689# define _GL_WARN_EXTERN_C extern 690# endif 691#endif 692 693/* Macros for stringification. */ 694#define _GL_STDIO_STRINGIZE(token) #token 695#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) 696 697/* When also using extern inline, suppress the use of static inline in 698 standard headers of problematic Apple configurations, as Libc at 699 least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., 700 <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. 701 Perhaps Apple will fix this some day. */ 702#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ 703 && defined __GNUC__ && defined __STDC__) 704# undef putc_unlocked 705#endif 706 707#if 0 708# if 0 709# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 710# define dprintf rpl_dprintf 711# endif 712_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) 713 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 714 _GL_ARG_NONNULL ((2))); 715_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); 716# else 717# if !1 718_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) 719 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 720 _GL_ARG_NONNULL ((2))); 721# endif 722_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); 723# endif 724_GL_CXXALIASWARN (dprintf); 725#elif defined GNULIB_POSIXCHECK 726# undef dprintf 727# if HAVE_RAW_DECL_DPRINTF 728_GL_WARN_ON_USE (dprintf, "dprintf is unportable - " 729 "use gnulib module dprintf for portability"); 730# endif 731#endif 732 733#if 0 734/* Close STREAM and its underlying file descriptor. */ 735# if 0 736# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 737# define fclose rpl_fclose 738# endif 739_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 740_GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); 741# else 742_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); 743# endif 744# if __GLIBC__ >= 2 745_GL_CXXALIASWARN (fclose); 746# endif 747#elif defined GNULIB_POSIXCHECK 748# undef fclose 749/* Assume fclose is always declared. */ 750_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " 751 "use gnulib module fclose for portable POSIX compliance"); 752#endif 753 754#if 1 755/* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is 756 not required. In C++ with GNULIB_NAMESPACE, avoid differences between 757 platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have 758 it. */ 759# if defined _WIN32 && !defined __CYGWIN__ 760# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 761# undef fcloseall 762# define fcloseall _fcloseall 763# endif 764_GL_CXXALIAS_MDA (fcloseall, int, (void)); 765# else 766# if 0 767# if defined __FreeBSD__ || defined __DragonFly__ 768_GL_CXXALIAS_SYS (fcloseall, void, (void)); 769# else 770_GL_CXXALIAS_SYS (fcloseall, int, (void)); 771# endif 772# endif 773# endif 774# if (defined _WIN32 && !defined __CYGWIN__) || 0 775_GL_CXXALIASWARN (fcloseall); 776# endif 777#endif 778 779#if 0 780# if 0 781# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 782# undef fdopen 783# define fdopen rpl_fdopen 784# endif 785_GL_FUNCDECL_RPL (fdopen, FILE *, 786 (int fd, const char *mode) 787 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 788_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); 789# elif defined _WIN32 && !defined __CYGWIN__ 790# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 791# undef fdopen 792# define fdopen _fdopen 793# endif 794_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); 795# else 796# if __GNUC__ >= 11 797/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ 798_GL_FUNCDECL_SYS (fdopen, FILE *, 799 (int fd, const char *mode) 800 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 801# endif 802_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); 803# endif 804_GL_CXXALIASWARN (fdopen); 805#else 806# if 0 && __GNUC__ >= 11 && !defined fdopen 807/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ 808_GL_FUNCDECL_SYS (fdopen, FILE *, 809 (int fd, const char *mode) 810 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 811# endif 812# if defined GNULIB_POSIXCHECK 813# undef fdopen 814/* Assume fdopen is always declared. */ 815_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " 816 "use gnulib module fdopen for portability"); 817# elif 1 818/* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not 819 required. In C++ with GNULIB_NAMESPACE, avoid differences between 820 platforms by defining GNULIB_NAMESPACE::fdopen always. */ 821# if defined _WIN32 && !defined __CYGWIN__ 822# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 823# undef fdopen 824# define fdopen _fdopen 825# endif 826_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); 827# else 828_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); 829# endif 830_GL_CXXALIASWARN (fdopen); 831# endif 832#endif 833 834#if 0 835/* Flush all pending data on STREAM according to POSIX rules. Both 836 output and seekable input streams are supported. 837 Note! LOSS OF DATA can occur if fflush is applied on an input stream 838 that is _not_seekable_ or on an update stream that is _not_seekable_ 839 and in which the most recent operation was input. Seekability can 840 be tested with lseek(fileno(fp),0,SEEK_CUR). */ 841# if 0 842# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 843# define fflush rpl_fflush 844# endif 845_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); 846_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); 847# else 848_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); 849# endif 850# if __GLIBC__ >= 2 851_GL_CXXALIASWARN (fflush); 852# endif 853#elif defined GNULIB_POSIXCHECK 854# undef fflush 855/* Assume fflush is always declared. */ 856_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " 857 "use gnulib module fflush for portable POSIX compliance"); 858#endif 859 860#if 1 861# if 0 && 0 862# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 863# undef fgetc 864# define fgetc rpl_fgetc 865# endif 866_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 867_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); 868# else 869_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); 870# endif 871# if __GLIBC__ >= 2 872_GL_CXXALIASWARN (fgetc); 873# endif 874#endif 875 876#if 1 877# if 0 && 0 878# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 879# undef fgets 880# define fgets rpl_fgets 881# endif 882_GL_FUNCDECL_RPL (fgets, char *, 883 (char *restrict s, int n, FILE *restrict stream) 884 _GL_ARG_NONNULL ((1, 3))); 885_GL_CXXALIAS_RPL (fgets, char *, 886 (char *restrict s, int n, FILE *restrict stream)); 887# else 888_GL_CXXALIAS_SYS (fgets, char *, 889 (char *restrict s, int n, FILE *restrict stream)); 890# endif 891# if __GLIBC__ >= 2 892_GL_CXXALIASWARN (fgets); 893# endif 894#endif 895 896#if 1 897/* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not 898 required. In C++ with GNULIB_NAMESPACE, avoid differences between 899 platforms by defining GNULIB_NAMESPACE::fileno always. */ 900# if defined _WIN32 && !defined __CYGWIN__ 901# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 902# undef fileno 903# define fileno _fileno 904# endif 905_GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream)); 906# else 907_GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream)); 908# endif 909_GL_CXXALIASWARN (fileno); 910#endif 911 912#if 0 913# if (0 && 0) \ 914 || (0 && 0) 915# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 916# undef fopen 917# define fopen rpl_fopen 918# endif 919_GL_FUNCDECL_RPL (fopen, FILE *, 920 (const char *restrict filename, const char *restrict mode) 921 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 922_GL_CXXALIAS_RPL (fopen, FILE *, 923 (const char *restrict filename, const char *restrict mode)); 924# else 925# if __GNUC__ >= 11 926/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ 927_GL_FUNCDECL_SYS (fopen, FILE *, 928 (const char *restrict filename, const char *restrict mode) 929 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 930# endif 931_GL_CXXALIAS_SYS (fopen, FILE *, 932 (const char *restrict filename, const char *restrict mode)); 933# endif 934# if __GLIBC__ >= 2 935_GL_CXXALIASWARN (fopen); 936# endif 937#else 938# if 0 && __GNUC__ >= 11 && !defined fopen 939/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ 940_GL_FUNCDECL_SYS (fopen, FILE *, 941 (const char *restrict filename, const char *restrict mode) 942 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 943# endif 944# if defined GNULIB_POSIXCHECK 945# undef fopen 946/* Assume fopen is always declared. */ 947_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " 948 "use gnulib module fopen for portability"); 949# endif 950#endif 951 952#if 0 || 1 953# if (0 && 0) \ 954 || (1 && 0 && (0 || 0)) 955# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 956# define fprintf rpl_fprintf 957# endif 958# define GNULIB_overrides_fprintf 1 959# if 0 || 0 960_GL_FUNCDECL_RPL (fprintf, int, 961 (FILE *restrict fp, const char *restrict format, ...) 962 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 963 _GL_ARG_NONNULL ((1, 2))); 964# else 965_GL_FUNCDECL_RPL (fprintf, int, 966 (FILE *restrict fp, const char *restrict format, ...) 967 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) 968 _GL_ARG_NONNULL ((1, 2))); 969# endif 970_GL_CXXALIAS_RPL (fprintf, int, 971 (FILE *restrict fp, const char *restrict format, ...)); 972# else 973_GL_CXXALIAS_SYS (fprintf, int, 974 (FILE *restrict fp, const char *restrict format, ...)); 975# endif 976# if __GLIBC__ >= 2 977_GL_CXXALIASWARN (fprintf); 978# endif 979#endif 980#if !0 && defined GNULIB_POSIXCHECK 981# if !GNULIB_overrides_fprintf 982# undef fprintf 983# endif 984/* Assume fprintf is always declared. */ 985_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " 986 "use gnulib module fprintf-posix for portable " 987 "POSIX compliance"); 988#endif 989 990#if 0 991/* Discard all pending buffered I/O data on STREAM. 992 STREAM must not be wide-character oriented. 993 When discarding pending output, the file position is set back to where it 994 was before the write calls. When discarding pending input, the file 995 position is advanced to match the end of the previously read input. 996 Return 0 if successful. Upon error, return -1 and set errno. */ 997# if 0 998# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 999# define fpurge rpl_fpurge 1000# endif 1001_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 1002_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); 1003# else 1004# if !1 1005_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 1006# endif 1007_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); 1008# endif 1009_GL_CXXALIASWARN (fpurge); 1010#elif defined GNULIB_POSIXCHECK 1011# undef fpurge 1012# if HAVE_RAW_DECL_FPURGE 1013_GL_WARN_ON_USE (fpurge, "fpurge is not always present - " 1014 "use gnulib module fpurge for portability"); 1015# endif 1016#endif 1017 1018#if 1 1019# if 0 && (0 || 0) 1020# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1021# undef fputc 1022# define fputc rpl_fputc 1023# endif 1024_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 1025_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); 1026# else 1027_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); 1028# endif 1029# if __GLIBC__ >= 2 1030_GL_CXXALIASWARN (fputc); 1031# endif 1032#endif 1033 1034#if 1 1035# if 0 && (0 || 0) 1036# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1037# undef fputs 1038# define fputs rpl_fputs 1039# endif 1040_GL_FUNCDECL_RPL (fputs, int, 1041 (const char *restrict string, FILE *restrict stream) 1042 _GL_ARG_NONNULL ((1, 2))); 1043_GL_CXXALIAS_RPL (fputs, int, 1044 (const char *restrict string, FILE *restrict stream)); 1045# else 1046_GL_CXXALIAS_SYS (fputs, int, 1047 (const char *restrict string, FILE *restrict stream)); 1048# endif 1049# if __GLIBC__ >= 2 1050_GL_CXXALIASWARN (fputs); 1051# endif 1052#endif 1053 1054#if 1 1055# if 0 && 0 1056# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1057# undef fread 1058# define fread rpl_fread 1059# endif 1060_GL_FUNCDECL_RPL (fread, size_t, 1061 (void *restrict ptr, size_t s, size_t n, 1062 FILE *restrict stream) 1063 _GL_ARG_NONNULL ((4))); 1064_GL_CXXALIAS_RPL (fread, size_t, 1065 (void *restrict ptr, size_t s, size_t n, 1066 FILE *restrict stream)); 1067# else 1068_GL_CXXALIAS_SYS (fread, size_t, 1069 (void *restrict ptr, size_t s, size_t n, 1070 FILE *restrict stream)); 1071# endif 1072# if __GLIBC__ >= 2 1073_GL_CXXALIASWARN (fread); 1074# endif 1075#endif 1076 1077#if 0 1078# if 0 1079# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1080# undef freopen 1081# define freopen rpl_freopen 1082# endif 1083_GL_FUNCDECL_RPL (freopen, FILE *, 1084 (const char *restrict filename, const char *restrict mode, 1085 FILE *restrict stream) 1086 _GL_ARG_NONNULL ((2, 3))); 1087_GL_CXXALIAS_RPL (freopen, FILE *, 1088 (const char *restrict filename, const char *restrict mode, 1089 FILE *restrict stream)); 1090# else 1091_GL_CXXALIAS_SYS (freopen, FILE *, 1092 (const char *restrict filename, const char *restrict mode, 1093 FILE *restrict stream)); 1094# endif 1095# if __GLIBC__ >= 2 1096_GL_CXXALIASWARN (freopen); 1097# endif 1098#elif defined GNULIB_POSIXCHECK 1099# undef freopen 1100/* Assume freopen is always declared. */ 1101_GL_WARN_ON_USE (freopen, 1102 "freopen on native Windows platforms is not POSIX compliant - " 1103 "use gnulib module freopen for portability"); 1104#endif 1105 1106#if 1 1107# if 0 && 0 1108# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1109# undef fscanf 1110# define fscanf rpl_fscanf 1111# endif 1112_GL_FUNCDECL_RPL (fscanf, int, 1113 (FILE *restrict stream, const char *restrict format, ...) 1114 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) 1115 _GL_ARG_NONNULL ((1, 2))); 1116_GL_CXXALIAS_RPL (fscanf, int, 1117 (FILE *restrict stream, const char *restrict format, ...)); 1118# else 1119_GL_CXXALIAS_SYS (fscanf, int, 1120 (FILE *restrict stream, const char *restrict format, ...)); 1121# endif 1122# if __GLIBC__ >= 2 1123_GL_CXXALIASWARN (fscanf); 1124# endif 1125#endif 1126 1127 1128/* Set up the following warnings, based on which modules are in use. 1129 GNU Coding Standards discourage the use of fseek, since it imposes 1130 an arbitrary limitation on some 32-bit hosts. Remember that the 1131 fseek module depends on the fseeko module, so we only have three 1132 cases to consider: 1133 1134 1. The developer is not using either module. Issue a warning under 1135 GNULIB_POSIXCHECK for both functions, to remind them that both 1136 functions have bugs on some systems. _GL_NO_LARGE_FILES has no 1137 impact on this warning. 1138 1139 2. The developer is using both modules. They may be unaware of the 1140 arbitrary limitations of fseek, so issue a warning under 1141 GNULIB_POSIXCHECK. On the other hand, they may be using both 1142 modules intentionally, so the developer can define 1143 _GL_NO_LARGE_FILES in the compilation units where the use of fseek 1144 is safe, to silence the warning. 1145 1146 3. The developer is using the fseeko module, but not fseek. Gnulib 1147 guarantees that fseek will still work around platform bugs in that 1148 case, but we presume that the developer is aware of the pitfalls of 1149 fseek and was trying to avoid it, so issue a warning even when 1150 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be 1151 defined to silence the warning in particular compilation units. 1152 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that 1153 fseek gets defined as a macro, it is recommended that the developer 1154 uses the fseek module, even if he is not calling the fseek function. 1155 1156 Most gnulib clients that perform stream operations should fall into 1157 category 3. */ 1158 1159#if 0 1160# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES 1161# define _GL_FSEEK_WARN /* Category 2, above. */ 1162# undef fseek 1163# endif 1164# if 0 1165# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1166# undef fseek 1167# define fseek rpl_fseek 1168# endif 1169_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) 1170 _GL_ARG_NONNULL ((1))); 1171_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); 1172# else 1173_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); 1174# endif 1175# if __GLIBC__ >= 2 1176_GL_CXXALIASWARN (fseek); 1177# endif 1178#endif 1179 1180#if 0 1181# if !0 && !defined _GL_NO_LARGE_FILES 1182# define _GL_FSEEK_WARN /* Category 3, above. */ 1183# undef fseek 1184# endif 1185# if 0 1186/* Provide an fseeko function that is aware of a preceding fflush(), and which 1187 detects pipes. */ 1188# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1189# undef fseeko 1190# define fseeko rpl_fseeko 1191# endif 1192_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) 1193 _GL_ARG_NONNULL ((1))); 1194_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); 1195# else 1196# if ! 1 1197_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) 1198 _GL_ARG_NONNULL ((1))); 1199# endif 1200_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); 1201# endif 1202_GL_CXXALIASWARN (fseeko); 1203#elif defined GNULIB_POSIXCHECK 1204# define _GL_FSEEK_WARN /* Category 1, above. */ 1205# undef fseek 1206# undef fseeko 1207# if HAVE_RAW_DECL_FSEEKO 1208_GL_WARN_ON_USE (fseeko, "fseeko is unportable - " 1209 "use gnulib module fseeko for portability"); 1210# endif 1211#endif 1212 1213#ifdef _GL_FSEEK_WARN 1214# undef _GL_FSEEK_WARN 1215/* Here, either fseek is undefined (but C89 guarantees that it is 1216 declared), or it is defined as rpl_fseek (declared above). */ 1217_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " 1218 "on 32-bit platforms - " 1219 "use fseeko function for handling of large files"); 1220#endif 1221 1222 1223/* ftell, ftello. See the comments on fseek/fseeko. */ 1224 1225#if 0 1226# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES 1227# define _GL_FTELL_WARN /* Category 2, above. */ 1228# undef ftell 1229# endif 1230# if 0 1231# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1232# undef ftell 1233# define ftell rpl_ftell 1234# endif 1235_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); 1236_GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); 1237# else 1238_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); 1239# endif 1240# if __GLIBC__ >= 2 1241_GL_CXXALIASWARN (ftell); 1242# endif 1243#endif 1244 1245#if 0 1246# if !0 && !defined _GL_NO_LARGE_FILES 1247# define _GL_FTELL_WARN /* Category 3, above. */ 1248# undef ftell 1249# endif 1250# if 0 1251# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1252# undef ftello 1253# define ftello rpl_ftello 1254# endif 1255_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 1256_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); 1257# else 1258# if ! 1 1259_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 1260# endif 1261_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); 1262# endif 1263_GL_CXXALIASWARN (ftello); 1264#elif defined GNULIB_POSIXCHECK 1265# define _GL_FTELL_WARN /* Category 1, above. */ 1266# undef ftell 1267# undef ftello 1268# if HAVE_RAW_DECL_FTELLO 1269_GL_WARN_ON_USE (ftello, "ftello is unportable - " 1270 "use gnulib module ftello for portability"); 1271# endif 1272#endif 1273 1274#ifdef _GL_FTELL_WARN 1275# undef _GL_FTELL_WARN 1276/* Here, either ftell is undefined (but C89 guarantees that it is 1277 declared), or it is defined as rpl_ftell (declared above). */ 1278_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " 1279 "on 32-bit platforms - " 1280 "use ftello function for handling of large files"); 1281#endif 1282 1283 1284#if 1 1285# if 0 && (0 || 0) 1286# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1287# undef fwrite 1288# define fwrite rpl_fwrite 1289# endif 1290_GL_FUNCDECL_RPL (fwrite, size_t, 1291 (const void *restrict ptr, size_t s, size_t n, 1292 FILE *restrict stream) 1293 _GL_ARG_NONNULL ((1, 4))); 1294_GL_CXXALIAS_RPL (fwrite, size_t, 1295 (const void *restrict ptr, size_t s, size_t n, 1296 FILE *restrict stream)); 1297# else 1298_GL_CXXALIAS_SYS (fwrite, size_t, 1299 (const void *restrict ptr, size_t s, size_t n, 1300 FILE *restrict stream)); 1301 1302/* Work around bug 11959 when fortifying glibc 2.4 through 2.15 1303 <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>, 1304 which sometimes causes an unwanted diagnostic for fwrite calls. 1305 This affects only function declaration attributes under certain 1306 versions of gcc and clang, and is not needed for C++. */ 1307# if (0 < __USE_FORTIFY_LEVEL \ 1308 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ 1309 && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ 1310 && !defined __cplusplus) 1311# undef fwrite 1312# undef fwrite_unlocked 1313extern size_t __REDIRECT (rpl_fwrite, 1314 (const void *__restrict, size_t, size_t, 1315 FILE *__restrict), 1316 fwrite); 1317extern size_t __REDIRECT (rpl_fwrite_unlocked, 1318 (const void *__restrict, size_t, size_t, 1319 FILE *__restrict), 1320 fwrite_unlocked); 1321# define fwrite rpl_fwrite 1322# define fwrite_unlocked rpl_fwrite_unlocked 1323# endif 1324# endif 1325# if __GLIBC__ >= 2 1326_GL_CXXALIASWARN (fwrite); 1327# endif 1328#endif 1329 1330#if 1 1331# if 0 && 0 1332# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1333# undef getc 1334# define getc rpl_fgetc 1335# endif 1336_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 1337_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); 1338# else 1339_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); 1340# endif 1341# if __GLIBC__ >= 2 1342_GL_CXXALIASWARN (getc); 1343# endif 1344#endif 1345 1346#if 1 1347# if 0 && 0 1348# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1349# undef getchar 1350# define getchar rpl_getchar 1351# endif 1352_GL_FUNCDECL_RPL (getchar, int, (void)); 1353_GL_CXXALIAS_RPL (getchar, int, (void)); 1354# else 1355_GL_CXXALIAS_SYS (getchar, int, (void)); 1356# endif 1357# if __GLIBC__ >= 2 1358_GL_CXXALIASWARN (getchar); 1359# endif 1360#endif 1361 1362#if 1 1363/* Read input, up to (and including) the next occurrence of DELIMITER, from 1364 STREAM, store it in *LINEPTR (and NUL-terminate it). 1365 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE 1366 bytes of space. It is realloc'd as necessary. 1367 Return the number of bytes read and stored at *LINEPTR (not including the 1368 NUL terminator), or -1 on error or EOF. */ 1369# if 1 1370# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1371# undef getdelim 1372# define getdelim rpl_getdelim 1373# endif 1374_GL_FUNCDECL_RPL (getdelim, ssize_t, 1375 (char **restrict lineptr, size_t *restrict linesize, 1376 int delimiter, 1377 FILE *restrict stream) 1378 _GL_ARG_NONNULL ((1, 2, 4))); 1379_GL_CXXALIAS_RPL (getdelim, ssize_t, 1380 (char **restrict lineptr, size_t *restrict linesize, 1381 int delimiter, 1382 FILE *restrict stream)); 1383# else 1384# if !1 1385_GL_FUNCDECL_SYS (getdelim, ssize_t, 1386 (char **restrict lineptr, size_t *restrict linesize, 1387 int delimiter, 1388 FILE *restrict stream) 1389 _GL_ARG_NONNULL ((1, 2, 4))); 1390# endif 1391_GL_CXXALIAS_SYS (getdelim, ssize_t, 1392 (char **restrict lineptr, size_t *restrict linesize, 1393 int delimiter, 1394 FILE *restrict stream)); 1395# endif 1396_GL_CXXALIASWARN (getdelim); 1397#elif defined GNULIB_POSIXCHECK 1398# undef getdelim 1399# if HAVE_RAW_DECL_GETDELIM 1400_GL_WARN_ON_USE (getdelim, "getdelim is unportable - " 1401 "use gnulib module getdelim for portability"); 1402# endif 1403#endif 1404 1405#if 1 1406/* Read a line, up to (and including) the next newline, from STREAM, store it 1407 in *LINEPTR (and NUL-terminate it). 1408 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE 1409 bytes of space. It is realloc'd as necessary. 1410 Return the number of bytes read and stored at *LINEPTR (not including the 1411 NUL terminator), or -1 on error or EOF. */ 1412# if 1 1413# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1414# undef getline 1415# define getline rpl_getline 1416# endif 1417_GL_FUNCDECL_RPL (getline, ssize_t, 1418 (char **restrict lineptr, size_t *restrict linesize, 1419 FILE *restrict stream) 1420 _GL_ARG_NONNULL ((1, 2, 3))); 1421_GL_CXXALIAS_RPL (getline, ssize_t, 1422 (char **restrict lineptr, size_t *restrict linesize, 1423 FILE *restrict stream)); 1424# else 1425# if !1 1426_GL_FUNCDECL_SYS (getline, ssize_t, 1427 (char **restrict lineptr, size_t *restrict linesize, 1428 FILE *restrict stream) 1429 _GL_ARG_NONNULL ((1, 2, 3))); 1430# endif 1431_GL_CXXALIAS_SYS (getline, ssize_t, 1432 (char **restrict lineptr, size_t *restrict linesize, 1433 FILE *restrict stream)); 1434# endif 1435# if 1 1436_GL_CXXALIASWARN (getline); 1437# endif 1438#elif defined GNULIB_POSIXCHECK 1439# undef getline 1440# if HAVE_RAW_DECL_GETLINE 1441_GL_WARN_ON_USE (getline, "getline is unportable - " 1442 "use gnulib module getline for portability"); 1443# endif 1444#endif 1445 1446/* It is very rare that the developer ever has full control of stdin, 1447 so any use of gets warrants an unconditional warning; besides, C11 1448 removed it. */ 1449#undef gets 1450#if HAVE_RAW_DECL_GETS && !defined __cplusplus 1451_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 1452#endif 1453 1454#if 1 1455/* On native Windows, map 'getw' to '_getw', so that -loldnames is not 1456 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1457 platforms by defining GNULIB_NAMESPACE::getw always. */ 1458# if defined _WIN32 && !defined __CYGWIN__ 1459# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1460# undef getw 1461# define getw _getw 1462# endif 1463_GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream)); 1464# else 1465_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); 1466# endif 1467_GL_CXXALIASWARN (getw); 1468#endif 1469 1470#if 0 || 0 1471struct obstack; 1472/* Grow an obstack with formatted output. Return the number of 1473 bytes added to OBS. No trailing nul byte is added, and the 1474 object should be closed with obstack_finish before use. Upon 1475 memory allocation error, call obstack_alloc_failed_handler. Upon 1476 other error, return -1. */ 1477# if 0 1478# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1479# define obstack_printf rpl_obstack_printf 1480# endif 1481_GL_FUNCDECL_RPL (obstack_printf, int, 1482 (struct obstack *obs, const char *format, ...) 1483 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1484 _GL_ARG_NONNULL ((1, 2))); 1485_GL_CXXALIAS_RPL (obstack_printf, int, 1486 (struct obstack *obs, const char *format, ...)); 1487# else 1488# if !1 1489_GL_FUNCDECL_SYS (obstack_printf, int, 1490 (struct obstack *obs, const char *format, ...) 1491 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1492 _GL_ARG_NONNULL ((1, 2))); 1493# endif 1494_GL_CXXALIAS_SYS (obstack_printf, int, 1495 (struct obstack *obs, const char *format, ...)); 1496# endif 1497_GL_CXXALIASWARN (obstack_printf); 1498# if 0 1499# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1500# define obstack_vprintf rpl_obstack_vprintf 1501# endif 1502_GL_FUNCDECL_RPL (obstack_vprintf, int, 1503 (struct obstack *obs, const char *format, va_list args) 1504 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1505 _GL_ARG_NONNULL ((1, 2))); 1506_GL_CXXALIAS_RPL (obstack_vprintf, int, 1507 (struct obstack *obs, const char *format, va_list args)); 1508# else 1509# if !1 1510_GL_FUNCDECL_SYS (obstack_vprintf, int, 1511 (struct obstack *obs, const char *format, va_list args) 1512 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1513 _GL_ARG_NONNULL ((1, 2))); 1514# endif 1515_GL_CXXALIAS_SYS (obstack_vprintf, int, 1516 (struct obstack *obs, const char *format, va_list args)); 1517# endif 1518_GL_CXXALIASWARN (obstack_vprintf); 1519#endif 1520 1521#if 0 1522# if !1 1523_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 1524# endif 1525_GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); 1526_GL_CXXALIASWARN (pclose); 1527#elif defined GNULIB_POSIXCHECK 1528# undef pclose 1529# if HAVE_RAW_DECL_PCLOSE 1530_GL_WARN_ON_USE (pclose, "pclose is unportable - " 1531 "use gnulib module pclose for more portability"); 1532# endif 1533#endif 1534 1535#if 0 1536/* Print a message to standard error, describing the value of ERRNO, 1537 (if STRING is not NULL and not empty) prefixed with STRING and ": ", 1538 and terminated with a newline. */ 1539# if 0 1540# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1541# define perror rpl_perror 1542# endif 1543_GL_FUNCDECL_RPL (perror, void, (const char *string)); 1544_GL_CXXALIAS_RPL (perror, void, (const char *string)); 1545# else 1546_GL_CXXALIAS_SYS (perror, void, (const char *string)); 1547# endif 1548# if __GLIBC__ >= 2 1549_GL_CXXALIASWARN (perror); 1550# endif 1551#elif defined GNULIB_POSIXCHECK 1552# undef perror 1553/* Assume perror is always declared. */ 1554_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " 1555 "use gnulib module perror for portability"); 1556#endif 1557 1558#if 0 1559# if 0 1560# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1561# undef popen 1562# define popen rpl_popen 1563# endif 1564_GL_FUNCDECL_RPL (popen, FILE *, 1565 (const char *cmd, const char *mode) 1566 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); 1567_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); 1568# else 1569# if !1 || __GNUC__ >= 11 1570_GL_FUNCDECL_SYS (popen, FILE *, 1571 (const char *cmd, const char *mode) 1572 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); 1573# endif 1574_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); 1575# endif 1576_GL_CXXALIASWARN (popen); 1577#else 1578# if 0 && __GNUC__ >= 11 && !defined popen 1579/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ 1580_GL_FUNCDECL_SYS (popen, FILE *, 1581 (const char *cmd, const char *mode) 1582 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); 1583# endif 1584# if defined GNULIB_POSIXCHECK 1585# undef popen 1586# if HAVE_RAW_DECL_POPEN 1587_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " 1588 "use gnulib module popen or pipe for more portability"); 1589# endif 1590# endif 1591#endif 1592 1593#if 0 || 1 1594# if (0 && 0) \ 1595 || (1 && 0 && (0 || 0)) 1596# if defined __GNUC__ || defined __clang__ 1597# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1598/* Don't break __attribute__((format(printf,M,N))). */ 1599# define printf __printf__ 1600# endif 1601# if 0 || 0 1602_GL_FUNCDECL_RPL_1 (__printf__, int, 1603 (const char *restrict format, ...) 1604 __asm__ ( 1605 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1606 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) 1607 _GL_ARG_NONNULL ((1))); 1608# else 1609_GL_FUNCDECL_RPL_1 (__printf__, int, 1610 (const char *restrict format, ...) 1611 __asm__ ( 1612 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1613 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) 1614 _GL_ARG_NONNULL ((1))); 1615# endif 1616_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); 1617# else 1618# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1619# define printf rpl_printf 1620# endif 1621_GL_FUNCDECL_RPL (printf, int, 1622 (const char *restrict format, ...) 1623 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) 1624 _GL_ARG_NONNULL ((1))); 1625_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); 1626# endif 1627# define GNULIB_overrides_printf 1 1628# else 1629_GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...)); 1630# endif 1631# if __GLIBC__ >= 2 1632_GL_CXXALIASWARN (printf); 1633# endif 1634#endif 1635#if !0 && defined GNULIB_POSIXCHECK 1636# if !GNULIB_overrides_printf 1637# undef printf 1638# endif 1639/* Assume printf is always declared. */ 1640_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " 1641 "use gnulib module printf-posix for portable " 1642 "POSIX compliance"); 1643#endif 1644 1645#if 1 1646# if 0 && (0 || 0) 1647# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1648# undef putc 1649# define putc rpl_fputc 1650# endif 1651_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 1652_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); 1653# else 1654_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); 1655# endif 1656# if __GLIBC__ >= 2 1657_GL_CXXALIASWARN (putc); 1658# endif 1659#endif 1660 1661#if 1 1662# if 0 && (0 || 0) 1663# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1664# undef putchar 1665# define putchar rpl_putchar 1666# endif 1667_GL_FUNCDECL_RPL (putchar, int, (int c)); 1668_GL_CXXALIAS_RPL (putchar, int, (int c)); 1669# else 1670_GL_CXXALIAS_SYS (putchar, int, (int c)); 1671# endif 1672# if __GLIBC__ >= 2 1673_GL_CXXALIASWARN (putchar); 1674# endif 1675#endif 1676 1677#if 1 1678# if 0 && (0 || 0) 1679# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1680# undef puts 1681# define puts rpl_puts 1682# endif 1683_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); 1684_GL_CXXALIAS_RPL (puts, int, (const char *string)); 1685# else 1686_GL_CXXALIAS_SYS (puts, int, (const char *string)); 1687# endif 1688# if __GLIBC__ >= 2 1689_GL_CXXALIASWARN (puts); 1690# endif 1691#endif 1692 1693#if 1 1694/* On native Windows, map 'putw' to '_putw', so that -loldnames is not 1695 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1696 platforms by defining GNULIB_NAMESPACE::putw always. */ 1697# if defined _WIN32 && !defined __CYGWIN__ 1698# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1699# undef putw 1700# define putw _putw 1701# endif 1702_GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream)); 1703# else 1704_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); 1705# endif 1706_GL_CXXALIASWARN (putw); 1707#endif 1708 1709#if 0 1710# if 0 1711# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1712# undef remove 1713# define remove rpl_remove 1714# endif 1715_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); 1716_GL_CXXALIAS_RPL (remove, int, (const char *name)); 1717# else 1718_GL_CXXALIAS_SYS (remove, int, (const char *name)); 1719# endif 1720# if __GLIBC__ >= 2 1721_GL_CXXALIASWARN (remove); 1722# endif 1723#elif defined GNULIB_POSIXCHECK 1724# undef remove 1725/* Assume remove is always declared. */ 1726_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " 1727 "use gnulib module remove for more portability"); 1728#endif 1729 1730#if 1 1731# if 0 1732# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1733# undef rename 1734# define rename rpl_rename 1735# endif 1736_GL_FUNCDECL_RPL (rename, int, 1737 (const char *old_filename, const char *new_filename) 1738 _GL_ARG_NONNULL ((1, 2))); 1739_GL_CXXALIAS_RPL (rename, int, 1740 (const char *old_filename, const char *new_filename)); 1741# else 1742_GL_CXXALIAS_SYS (rename, int, 1743 (const char *old_filename, const char *new_filename)); 1744# endif 1745# if __GLIBC__ >= 2 1746_GL_CXXALIASWARN (rename); 1747# endif 1748#elif defined GNULIB_POSIXCHECK 1749# undef rename 1750/* Assume rename is always declared. */ 1751_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " 1752 "use gnulib module rename for more portability"); 1753#endif 1754 1755#if 0 1756# if 0 1757# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1758# undef renameat 1759# define renameat rpl_renameat 1760# endif 1761_GL_FUNCDECL_RPL (renameat, int, 1762 (int fd1, char const *file1, int fd2, char const *file2) 1763 _GL_ARG_NONNULL ((2, 4))); 1764_GL_CXXALIAS_RPL (renameat, int, 1765 (int fd1, char const *file1, int fd2, char const *file2)); 1766# else 1767# if !1 1768_GL_FUNCDECL_SYS (renameat, int, 1769 (int fd1, char const *file1, int fd2, char const *file2) 1770 _GL_ARG_NONNULL ((2, 4))); 1771# endif 1772_GL_CXXALIAS_SYS (renameat, int, 1773 (int fd1, char const *file1, int fd2, char const *file2)); 1774# endif 1775_GL_CXXALIASWARN (renameat); 1776#elif defined GNULIB_POSIXCHECK 1777# undef renameat 1778# if HAVE_RAW_DECL_RENAMEAT 1779_GL_WARN_ON_USE (renameat, "renameat is not portable - " 1780 "use gnulib module renameat for portability"); 1781# endif 1782#endif 1783 1784#if 1 1785# if 0 && 0 1786# if defined __GNUC__ || defined __clang__ 1787# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1788# undef scanf 1789/* Don't break __attribute__((format(scanf,M,N))). */ 1790# define scanf __scanf__ 1791# endif 1792_GL_FUNCDECL_RPL_1 (__scanf__, int, 1793 (const char *restrict format, ...) 1794 __asm__ ( 1795 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) 1796 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1797 _GL_ARG_NONNULL ((1))); 1798_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); 1799# else 1800# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1801# undef scanf 1802# define scanf rpl_scanf 1803# endif 1804_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) 1805 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1806 _GL_ARG_NONNULL ((1))); 1807_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); 1808# endif 1809# else 1810_GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...)); 1811# endif 1812# if __GLIBC__ >= 2 1813_GL_CXXALIASWARN (scanf); 1814# endif 1815#endif 1816 1817#if 0 1818# if 0 1819# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1820# define snprintf rpl_snprintf 1821# endif 1822# define GNULIB_overrides_snprintf 1 1823_GL_FUNCDECL_RPL (snprintf, int, 1824 (char *restrict str, size_t size, 1825 const char *restrict format, ...) 1826 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) 1827 _GL_ARG_NONNULL ((3))); 1828_GL_CXXALIAS_RPL (snprintf, int, 1829 (char *restrict str, size_t size, 1830 const char *restrict format, ...)); 1831# else 1832# if !1 1833_GL_FUNCDECL_SYS (snprintf, int, 1834 (char *restrict str, size_t size, 1835 const char *restrict format, ...) 1836 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) 1837 _GL_ARG_NONNULL ((3))); 1838# endif 1839_GL_CXXALIAS_SYS (snprintf, int, 1840 (char *restrict str, size_t size, 1841 const char *restrict format, ...)); 1842# endif 1843# if __GLIBC__ >= 2 1844_GL_CXXALIASWARN (snprintf); 1845# endif 1846#elif defined GNULIB_POSIXCHECK 1847# undef snprintf 1848# if HAVE_RAW_DECL_SNPRINTF 1849_GL_WARN_ON_USE (snprintf, "snprintf is unportable - " 1850 "use gnulib module snprintf for portability"); 1851# endif 1852#endif 1853 1854/* Some people would argue that all sprintf uses should be warned about 1855 (for example, OpenBSD issues a link warning for it), 1856 since it can cause security holes due to buffer overruns. 1857 However, we believe that sprintf can be used safely, and is more 1858 efficient than snprintf in those safe cases; and as proof of our 1859 belief, we use sprintf in several gnulib modules. So this header 1860 intentionally avoids adding a warning to sprintf except when 1861 GNULIB_POSIXCHECK is defined. */ 1862 1863#if 0 1864# if 0 1865# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1866# define sprintf rpl_sprintf 1867# endif 1868# define GNULIB_overrides_sprintf 1 1869_GL_FUNCDECL_RPL (sprintf, int, 1870 (char *restrict str, const char *restrict format, ...) 1871 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1872 _GL_ARG_NONNULL ((1, 2))); 1873_GL_CXXALIAS_RPL (sprintf, int, 1874 (char *restrict str, const char *restrict format, ...)); 1875# else 1876_GL_CXXALIAS_SYS (sprintf, int, 1877 (char *restrict str, const char *restrict format, ...)); 1878# endif 1879# if __GLIBC__ >= 2 1880_GL_CXXALIASWARN (sprintf); 1881# endif 1882#elif defined GNULIB_POSIXCHECK 1883# undef sprintf 1884/* Assume sprintf is always declared. */ 1885_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " 1886 "use gnulib module sprintf-posix for portable " 1887 "POSIX compliance"); 1888#endif 1889 1890#if 1 1891/* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not 1892 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1893 platforms by defining GNULIB_NAMESPACE::tempnam always. */ 1894# if defined _WIN32 && !defined __CYGWIN__ 1895# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1896# undef tempnam 1897# define tempnam _tempnam 1898# endif 1899_GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix)); 1900# else 1901_GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix)); 1902# endif 1903_GL_CXXALIASWARN (tempnam); 1904#endif 1905 1906#if 0 1907# if 0 1908# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1909# define tmpfile rpl_tmpfile 1910# endif 1911_GL_FUNCDECL_RPL (tmpfile, FILE *, (void) 1912 _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 1913_GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); 1914# else 1915# if __GNUC__ >= 11 1916/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ 1917_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) 1918 _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 1919# endif 1920_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); 1921# endif 1922# if __GLIBC__ >= 2 1923_GL_CXXALIASWARN (tmpfile); 1924# endif 1925#else 1926# if 0 && __GNUC__ >= 11 && !defined tmpfile 1927/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ 1928_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) 1929 _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 1930# endif 1931# if defined GNULIB_POSIXCHECK 1932# undef tmpfile 1933# if HAVE_RAW_DECL_TMPFILE 1934_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " 1935 "use gnulib module tmpfile for portability"); 1936# endif 1937# endif 1938#endif 1939 1940#if 0 1941/* Write formatted output to a string dynamically allocated with malloc(). 1942 If the memory allocation succeeds, store the address of the string in 1943 *RESULT and return the number of resulting bytes, excluding the trailing 1944 NUL. Upon memory allocation error, or some other error, return -1. */ 1945# if 0 1946# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1947# define asprintf rpl_asprintf 1948# endif 1949# define GNULIB_overrides_asprintf 1950_GL_FUNCDECL_RPL (asprintf, int, 1951 (char **result, const char *format, ...) 1952 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1953 _GL_ARG_NONNULL ((1, 2))); 1954_GL_CXXALIAS_RPL (asprintf, int, 1955 (char **result, const char *format, ...)); 1956# else 1957# if !1 1958_GL_FUNCDECL_SYS (asprintf, int, 1959 (char **result, const char *format, ...) 1960 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1961 _GL_ARG_NONNULL ((1, 2))); 1962# endif 1963_GL_CXXALIAS_SYS (asprintf, int, 1964 (char **result, const char *format, ...)); 1965# endif 1966_GL_CXXALIASWARN (asprintf); 1967# if 0 1968# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1969# define vasprintf rpl_vasprintf 1970# endif 1971# define GNULIB_overrides_vasprintf 1 1972_GL_FUNCDECL_RPL (vasprintf, int, 1973 (char **result, const char *format, va_list args) 1974 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1975 _GL_ARG_NONNULL ((1, 2))); 1976_GL_CXXALIAS_RPL (vasprintf, int, 1977 (char **result, const char *format, va_list args)); 1978# else 1979# if !1 1980_GL_FUNCDECL_SYS (vasprintf, int, 1981 (char **result, const char *format, va_list args) 1982 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1983 _GL_ARG_NONNULL ((1, 2))); 1984# endif 1985_GL_CXXALIAS_SYS (vasprintf, int, 1986 (char **result, const char *format, va_list args)); 1987# endif 1988_GL_CXXALIASWARN (vasprintf); 1989#endif 1990 1991#if 0 1992# if 0 1993# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1994# define vdprintf rpl_vdprintf 1995# endif 1996_GL_FUNCDECL_RPL (vdprintf, int, 1997 (int fd, const char *restrict format, va_list args) 1998 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1999 _GL_ARG_NONNULL ((2))); 2000_GL_CXXALIAS_RPL (vdprintf, int, 2001 (int fd, const char *restrict format, va_list args)); 2002# else 2003# if !1 2004_GL_FUNCDECL_SYS (vdprintf, int, 2005 (int fd, const char *restrict format, va_list args) 2006 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 2007 _GL_ARG_NONNULL ((2))); 2008# endif 2009/* Need to cast, because on Solaris, the third parameter will likely be 2010 __va_list args. */ 2011_GL_CXXALIAS_SYS_CAST (vdprintf, int, 2012 (int fd, const char *restrict format, va_list args)); 2013# endif 2014# if __GLIBC__ >= 2 2015_GL_CXXALIASWARN (vdprintf); 2016# endif 2017#elif defined GNULIB_POSIXCHECK 2018# undef vdprintf 2019# if HAVE_RAW_DECL_VDPRINTF 2020_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " 2021 "use gnulib module vdprintf for portability"); 2022# endif 2023#endif 2024 2025#if 0 || 1 2026# if (0 && 0) \ 2027 || (1 && 0 && (0 || 0)) 2028# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2029# define vfprintf rpl_vfprintf 2030# endif 2031# define GNULIB_overrides_vfprintf 1 2032# if 0 2033_GL_FUNCDECL_RPL (vfprintf, int, 2034 (FILE *restrict fp, 2035 const char *restrict format, va_list args) 2036 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 2037 _GL_ARG_NONNULL ((1, 2))); 2038# else 2039_GL_FUNCDECL_RPL (vfprintf, int, 2040 (FILE *restrict fp, 2041 const char *restrict format, va_list args) 2042 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) 2043 _GL_ARG_NONNULL ((1, 2))); 2044# endif 2045_GL_CXXALIAS_RPL (vfprintf, int, 2046 (FILE *restrict fp, 2047 const char *restrict format, va_list args)); 2048# else 2049/* Need to cast, because on Solaris, the third parameter is 2050 __va_list args 2051 and GCC's fixincludes did not change this to __gnuc_va_list. */ 2052_GL_CXXALIAS_SYS_CAST (vfprintf, int, 2053 (FILE *restrict fp, 2054 const char *restrict format, va_list args)); 2055# endif 2056# if __GLIBC__ >= 2 2057_GL_CXXALIASWARN (vfprintf); 2058# endif 2059#endif 2060#if !0 && defined GNULIB_POSIXCHECK 2061# if !GNULIB_overrides_vfprintf 2062# undef vfprintf 2063# endif 2064/* Assume vfprintf is always declared. */ 2065_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " 2066 "use gnulib module vfprintf-posix for portable " 2067 "POSIX compliance"); 2068#endif 2069 2070#if 0 2071# if 0 && 0 2072# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2073# undef vfscanf 2074# define vfscanf rpl_vfscanf 2075# endif 2076_GL_FUNCDECL_RPL (vfscanf, int, 2077 (FILE *restrict stream, 2078 const char *restrict format, va_list args) 2079 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) 2080 _GL_ARG_NONNULL ((1, 2))); 2081_GL_CXXALIAS_RPL (vfscanf, int, 2082 (FILE *restrict stream, 2083 const char *restrict format, va_list args)); 2084# else 2085_GL_CXXALIAS_SYS (vfscanf, int, 2086 (FILE *restrict stream, 2087 const char *restrict format, va_list args)); 2088# endif 2089# if __GLIBC__ >= 2 2090_GL_CXXALIASWARN (vfscanf); 2091# endif 2092#endif 2093 2094#if 0 || 1 2095# if (0 && 0) \ 2096 || (1 && 0 && (0 || 0)) 2097# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2098# define vprintf rpl_vprintf 2099# endif 2100# define GNULIB_overrides_vprintf 1 2101# if 0 || 0 2102_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 2103 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) 2104 _GL_ARG_NONNULL ((1))); 2105# else 2106_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 2107 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) 2108 _GL_ARG_NONNULL ((1))); 2109# endif 2110_GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args)); 2111# else 2112/* Need to cast, because on Solaris, the second parameter is 2113 __va_list args 2114 and GCC's fixincludes did not change this to __gnuc_va_list. */ 2115_GL_CXXALIAS_SYS_CAST (vprintf, int, 2116 (const char *restrict format, va_list args)); 2117# endif 2118# if __GLIBC__ >= 2 2119_GL_CXXALIASWARN (vprintf); 2120# endif 2121#endif 2122#if !0 && defined GNULIB_POSIXCHECK 2123# if !GNULIB_overrides_vprintf 2124# undef vprintf 2125# endif 2126/* Assume vprintf is always declared. */ 2127_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " 2128 "use gnulib module vprintf-posix for portable " 2129 "POSIX compliance"); 2130#endif 2131 2132#if 0 2133# if 0 && 0 2134# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2135# undef vscanf 2136# define vscanf rpl_vscanf 2137# endif 2138_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) 2139 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) 2140 _GL_ARG_NONNULL ((1))); 2141_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); 2142# else 2143_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); 2144# endif 2145# if __GLIBC__ >= 2 2146_GL_CXXALIASWARN (vscanf); 2147# endif 2148#endif 2149 2150#if 0 2151# if 0 2152# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2153# define vsnprintf rpl_vsnprintf 2154# endif 2155# define GNULIB_overrides_vsnprintf 1 2156_GL_FUNCDECL_RPL (vsnprintf, int, 2157 (char *restrict str, size_t size, 2158 const char *restrict format, va_list args) 2159 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) 2160 _GL_ARG_NONNULL ((3))); 2161_GL_CXXALIAS_RPL (vsnprintf, int, 2162 (char *restrict str, size_t size, 2163 const char *restrict format, va_list args)); 2164# else 2165# if !1 2166_GL_FUNCDECL_SYS (vsnprintf, int, 2167 (char *restrict str, size_t size, 2168 const char *restrict format, va_list args) 2169 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) 2170 _GL_ARG_NONNULL ((3))); 2171# endif 2172_GL_CXXALIAS_SYS (vsnprintf, int, 2173 (char *restrict str, size_t size, 2174 const char *restrict format, va_list args)); 2175# endif 2176# if __GLIBC__ >= 2 2177_GL_CXXALIASWARN (vsnprintf); 2178# endif 2179#elif defined GNULIB_POSIXCHECK 2180# undef vsnprintf 2181# if HAVE_RAW_DECL_VSNPRINTF 2182_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " 2183 "use gnulib module vsnprintf for portability"); 2184# endif 2185#endif 2186 2187#if 0 2188# if 0 2189# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2190# define vsprintf rpl_vsprintf 2191# endif 2192# define GNULIB_overrides_vsprintf 1 2193_GL_FUNCDECL_RPL (vsprintf, int, 2194 (char *restrict str, 2195 const char *restrict format, va_list args) 2196 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 2197 _GL_ARG_NONNULL ((1, 2))); 2198_GL_CXXALIAS_RPL (vsprintf, int, 2199 (char *restrict str, 2200 const char *restrict format, va_list args)); 2201# else 2202/* Need to cast, because on Solaris, the third parameter is 2203 __va_list args 2204 and GCC's fixincludes did not change this to __gnuc_va_list. */ 2205_GL_CXXALIAS_SYS_CAST (vsprintf, int, 2206 (char *restrict str, 2207 const char *restrict format, va_list args)); 2208# endif 2209# if __GLIBC__ >= 2 2210_GL_CXXALIASWARN (vsprintf); 2211# endif 2212#elif defined GNULIB_POSIXCHECK 2213# undef vsprintf 2214/* Assume vsprintf is always declared. */ 2215_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " 2216 "use gnulib module vsprintf-posix for portable " 2217 "POSIX compliance"); 2218#endif 2219 2220#endif /* _GL_STDIO_H */ 2221#endif /* _GL_STDIO_H */ 2222#endif 2223