1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* A GNU-like <stdlib.h>. 3 4 Copyright (C) 1995, 2001-2004, 2006-2020 Free Software Foundation, Inc. 5 6 This program is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 18 19 #if __GNUC__ >= 3 20 #pragma GCC system_header 21 #endif 22 23 24 #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc 25 /* Special invocation conventions inside some gnulib header files, 26 and inside some glibc header files, respectively. */ 27 28 #include_next <stdlib.h> 29 30 #else 31 /* Normal invocation convention. */ 32 33 #ifndef _GL_STDLIB_H 34 35 /* The include_next requires a split double-inclusion guard. */ 36 #include_next <stdlib.h> 37 38 #ifndef _GL_STDLIB_H 39 #define _GL_STDLIB_H 40 41 /* NetBSD 5.0 mis-defines NULL. */ 42 #include <stddef.h> 43 44 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */ 45 #if 0 && !defined WEXITSTATUS 46 # include <sys/wait.h> 47 #endif 48 49 /* Solaris declares getloadavg() in <sys/loadavg.h>. */ 50 #if (0 || defined GNULIB_POSIXCHECK) && 0 51 /* OpenIndiana has a bug: <sys/time.h> must be included before 52 <sys/loadavg.h>. */ 53 # include <sys/time.h> 54 # include <sys/loadavg.h> 55 #endif 56 57 /* Native Windows platforms declare mktemp() in <io.h>. */ 58 #if 0 && (defined _WIN32 && ! defined __CYGWIN__) 59 # include <io.h> 60 #endif 61 62 #if 0 63 64 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included 65 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need 66 'struct random_data'. */ 67 # if 1 68 # include <random.h> 69 # endif 70 71 # if !1 || 0 || !1 72 # include <stdint.h> 73 # endif 74 75 # if !1 76 /* Define 'struct random_data'. 77 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */ 78 # if !GNULIB_defined_struct_random_data 79 struct random_data 80 { 81 int32_t *fptr; /* Front pointer. */ 82 int32_t *rptr; /* Rear pointer. */ 83 int32_t *state; /* Array of state values. */ 84 int rand_type; /* Type of random number generator. */ 85 int rand_deg; /* Degree of random number generator. */ 86 int rand_sep; /* Distance between front and rear. */ 87 int32_t *end_ptr; /* Pointer behind state table. */ 88 }; 89 # define GNULIB_defined_struct_random_data 1 90 # endif 91 # endif 92 #endif 93 94 #if (0 || 0 || 0 || 0 || 0 || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__) 95 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */ 96 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */ 97 /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */ 98 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ 99 /* But avoid namespace pollution on glibc systems and native Windows. */ 100 # include <unistd.h> 101 #endif 102 103 /* The __attribute__ feature is available in gcc versions 2.5 and later. 104 The attribute __pure__ was added in gcc 2.96. */ 105 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) 106 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 107 #else 108 # define _GL_ATTRIBUTE_PURE /* empty */ 109 #endif 110 111 /* The definition of _Noreturn is copied here. */ 112 /* A C macro for declaring that a function does not return. 113 Copyright (C) 2011-2020 Free Software Foundation, Inc. 114 115 This program is free software: you can redistribute it and/or modify it 116 under the terms of the GNU General Public License as published 117 by the Free Software Foundation; either version 3 of the License, or 118 (at your option) any later version. 119 120 This program is distributed in the hope that it will be useful, 121 but WITHOUT ANY WARRANTY; without even the implied warranty of 122 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 123 General Public License for more details. 124 125 You should have received a copy of the GNU General Public License 126 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 127 128 #ifndef _Noreturn 129 # if (defined __cplusplus \ 130 && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ 131 || (defined _MSC_VER && 1900 <= _MSC_VER)) \ 132 && 0) 133 /* [[noreturn]] is not practically usable, because with it the syntax 134 extern _Noreturn void func (...); 135 would not be valid; such a declaration would only be valid with 'extern' 136 and '_Noreturn' swapped, or without the 'extern' keyword. However, some 137 AIX system header files and several gnulib header files use precisely 138 this syntax with 'extern'. */ 139 # define _Noreturn [[noreturn]] 140 # elif ((!defined __cplusplus || defined __clang__) \ 141 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ 142 || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))) 143 /* _Noreturn works as-is. */ 144 # elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C 145 # define _Noreturn __attribute__ ((__noreturn__)) 146 # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) 147 # define _Noreturn __declspec (noreturn) 148 # else 149 # define _Noreturn 150 # endif 151 #endif 152 153 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 154 /* C++ compatible function declaration macros. 155 Copyright (C) 2010-2020 Free Software Foundation, Inc. 156 157 This program is free software: you can redistribute it and/or modify it 158 under the terms of the GNU General Public License as published 159 by the Free Software Foundation; either version 3 of the License, or 160 (at your option) any later version. 161 162 This program is distributed in the hope that it will be useful, 163 but WITHOUT ANY WARRANTY; without even the implied warranty of 164 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 165 General Public License for more details. 166 167 You should have received a copy of the GNU General Public License 168 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 169 170 #ifndef _GL_CXXDEFS_H 171 #define _GL_CXXDEFS_H 172 173 /* Begin/end the GNULIB_NAMESPACE namespace. */ 174 #if defined __cplusplus && defined GNULIB_NAMESPACE 175 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 176 # define _GL_END_NAMESPACE } 177 #else 178 # define _GL_BEGIN_NAMESPACE 179 # define _GL_END_NAMESPACE 180 #endif 181 182 /* The three most frequent use cases of these macros are: 183 184 * For providing a substitute for a function that is missing on some 185 platforms, but is declared and works fine on the platforms on which 186 it exists: 187 188 #if @GNULIB_FOO@ 189 # if !@HAVE_FOO@ 190 _GL_FUNCDECL_SYS (foo, ...); 191 # endif 192 _GL_CXXALIAS_SYS (foo, ...); 193 _GL_CXXALIASWARN (foo); 194 #elif defined GNULIB_POSIXCHECK 195 ... 196 #endif 197 198 * For providing a replacement for a function that exists on all platforms, 199 but is broken/insufficient and needs to be replaced on some platforms: 200 201 #if @GNULIB_FOO@ 202 # if @REPLACE_FOO@ 203 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 204 # undef foo 205 # define foo rpl_foo 206 # endif 207 _GL_FUNCDECL_RPL (foo, ...); 208 _GL_CXXALIAS_RPL (foo, ...); 209 # else 210 _GL_CXXALIAS_SYS (foo, ...); 211 # endif 212 _GL_CXXALIASWARN (foo); 213 #elif defined GNULIB_POSIXCHECK 214 ... 215 #endif 216 217 * For providing a replacement for a function that exists on some platforms 218 but is broken/insufficient and needs to be replaced on some of them and 219 is additionally either missing or undeclared on some other platforms: 220 221 #if @GNULIB_FOO@ 222 # if @REPLACE_FOO@ 223 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 224 # undef foo 225 # define foo rpl_foo 226 # endif 227 _GL_FUNCDECL_RPL (foo, ...); 228 _GL_CXXALIAS_RPL (foo, ...); 229 # else 230 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 231 _GL_FUNCDECL_SYS (foo, ...); 232 # endif 233 _GL_CXXALIAS_SYS (foo, ...); 234 # endif 235 _GL_CXXALIASWARN (foo); 236 #elif defined GNULIB_POSIXCHECK 237 ... 238 #endif 239 */ 240 241 /* _GL_EXTERN_C declaration; 242 performs the declaration with C linkage. */ 243 #if defined __cplusplus 244 # define _GL_EXTERN_C extern "C" 245 #else 246 # define _GL_EXTERN_C extern 247 #endif 248 249 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 250 declares a replacement function, named rpl_func, with the given prototype, 251 consisting of return type, parameters, and attributes. 252 Example: 253 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 254 _GL_ARG_NONNULL ((1))); 255 */ 256 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 257 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 258 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 259 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 260 261 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 262 declares the system function, named func, with the given prototype, 263 consisting of return type, parameters, and attributes. 264 Example: 265 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 266 _GL_ARG_NONNULL ((1))); 267 */ 268 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 269 _GL_EXTERN_C rettype func parameters_and_attributes 270 271 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 272 declares a C++ alias called GNULIB_NAMESPACE::func 273 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 274 Example: 275 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 276 277 Wrapping rpl_func in an object with an inline conversion operator 278 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 279 actually used in the program. */ 280 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 281 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 282 #if defined __cplusplus && defined GNULIB_NAMESPACE 283 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 284 namespace GNULIB_NAMESPACE \ 285 { \ 286 static const struct _gl_ ## func ## _wrapper \ 287 { \ 288 typedef rettype (*type) parameters; \ 289 \ 290 inline operator type () const \ 291 { \ 292 return ::rpl_func; \ 293 } \ 294 } func = {}; \ 295 } \ 296 _GL_EXTERN_C int _gl_cxxalias_dummy 297 #else 298 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 299 _GL_EXTERN_C int _gl_cxxalias_dummy 300 #endif 301 302 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 303 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 304 except that the C function rpl_func may have a slightly different 305 declaration. A cast is used to silence the "invalid conversion" error 306 that would otherwise occur. */ 307 #if defined __cplusplus && defined GNULIB_NAMESPACE 308 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 309 namespace GNULIB_NAMESPACE \ 310 { \ 311 static const struct _gl_ ## func ## _wrapper \ 312 { \ 313 typedef rettype (*type) parameters; \ 314 \ 315 inline operator type () const \ 316 { \ 317 return reinterpret_cast<type>(::rpl_func); \ 318 } \ 319 } func = {}; \ 320 } \ 321 _GL_EXTERN_C int _gl_cxxalias_dummy 322 #else 323 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 324 _GL_EXTERN_C int _gl_cxxalias_dummy 325 #endif 326 327 /* _GL_CXXALIAS_SYS (func, rettype, parameters); 328 declares a C++ alias called GNULIB_NAMESPACE::func 329 that redirects to the system provided function func, if GNULIB_NAMESPACE 330 is defined. 331 Example: 332 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 333 334 Wrapping func in an object with an inline conversion operator 335 avoids a reference to func unless GNULIB_NAMESPACE::func is 336 actually used in the program. */ 337 #if defined __cplusplus && defined GNULIB_NAMESPACE 338 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 339 namespace GNULIB_NAMESPACE \ 340 { \ 341 static const struct _gl_ ## func ## _wrapper \ 342 { \ 343 typedef rettype (*type) parameters; \ 344 \ 345 inline operator type () const \ 346 { \ 347 return ::func; \ 348 } \ 349 } func = {}; \ 350 } \ 351 _GL_EXTERN_C int _gl_cxxalias_dummy 352 #else 353 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 354 _GL_EXTERN_C int _gl_cxxalias_dummy 355 #endif 356 357 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 358 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 359 except that the C function func may have a slightly different declaration. 360 A cast is used to silence the "invalid conversion" error that would 361 otherwise occur. */ 362 #if defined __cplusplus && defined GNULIB_NAMESPACE 363 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 364 namespace GNULIB_NAMESPACE \ 365 { \ 366 static const struct _gl_ ## func ## _wrapper \ 367 { \ 368 typedef rettype (*type) parameters; \ 369 \ 370 inline operator type () const \ 371 { \ 372 return reinterpret_cast<type>(::func); \ 373 } \ 374 } func = {}; \ 375 } \ 376 _GL_EXTERN_C int _gl_cxxalias_dummy 377 #else 378 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 379 _GL_EXTERN_C int _gl_cxxalias_dummy 380 #endif 381 382 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 383 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 384 except that the C function is picked among a set of overloaded functions, 385 namely the one with rettype2 and parameters2. Two consecutive casts 386 are used to silence the "cannot find a match" and "invalid conversion" 387 errors that would otherwise occur. */ 388 #if defined __cplusplus && defined GNULIB_NAMESPACE 389 /* The outer cast must be a reinterpret_cast. 390 The inner cast: When the function is defined as a set of overloaded 391 functions, it works as a static_cast<>, choosing the designated variant. 392 When the function is defined as a single variant, it works as a 393 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 394 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 395 namespace GNULIB_NAMESPACE \ 396 { \ 397 static const struct _gl_ ## func ## _wrapper \ 398 { \ 399 typedef rettype (*type) parameters; \ 400 \ 401 inline operator type () const \ 402 { \ 403 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 404 } \ 405 } func = {}; \ 406 } \ 407 _GL_EXTERN_C int _gl_cxxalias_dummy 408 #else 409 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 410 _GL_EXTERN_C int _gl_cxxalias_dummy 411 #endif 412 413 /* _GL_CXXALIASWARN (func); 414 causes a warning to be emitted when ::func is used but not when 415 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 416 variants. */ 417 #if defined __cplusplus && defined GNULIB_NAMESPACE 418 # define _GL_CXXALIASWARN(func) \ 419 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 420 # define _GL_CXXALIASWARN_1(func,namespace) \ 421 _GL_CXXALIASWARN_2 (func, namespace) 422 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 423 we enable the warning only when not optimizing. */ 424 # if !__OPTIMIZE__ 425 # define _GL_CXXALIASWARN_2(func,namespace) \ 426 _GL_WARN_ON_USE (func, \ 427 "The symbol ::" #func " refers to the system function. " \ 428 "Use " #namespace "::" #func " instead.") 429 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 430 # define _GL_CXXALIASWARN_2(func,namespace) \ 431 extern __typeof__ (func) func 432 # else 433 # define _GL_CXXALIASWARN_2(func,namespace) \ 434 _GL_EXTERN_C int _gl_cxxalias_dummy 435 # endif 436 #else 437 # define _GL_CXXALIASWARN(func) \ 438 _GL_EXTERN_C int _gl_cxxalias_dummy 439 #endif 440 441 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 442 causes a warning to be emitted when the given overloaded variant of ::func 443 is used but not when GNULIB_NAMESPACE::func is used. */ 444 #if defined __cplusplus && defined GNULIB_NAMESPACE 445 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 446 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 447 GNULIB_NAMESPACE) 448 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 449 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 450 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 451 we enable the warning only when not optimizing. */ 452 # if !__OPTIMIZE__ 453 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 454 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 455 "The symbol ::" #func " refers to the system function. " \ 456 "Use " #namespace "::" #func " instead.") 457 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 458 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 459 extern __typeof__ (func) func 460 # else 461 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 462 _GL_EXTERN_C int _gl_cxxalias_dummy 463 # endif 464 #else 465 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 466 _GL_EXTERN_C int _gl_cxxalias_dummy 467 #endif 468 469 #endif /* _GL_CXXDEFS_H */ 470 471 /* The definition of _GL_ARG_NONNULL is copied here. */ 472 /* A C macro for declaring that specific arguments must not be NULL. 473 Copyright (C) 2009-2020 Free Software Foundation, Inc. 474 475 This program is free software: you can redistribute it and/or modify it 476 under the terms of the GNU General Public License as published 477 by the Free Software Foundation; either version 3 of the License, or 478 (at your option) any later version. 479 480 This program is distributed in the hope that it will be useful, 481 but WITHOUT ANY WARRANTY; without even the implied warranty of 482 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 483 General Public License for more details. 484 485 You should have received a copy of the GNU General Public License 486 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 487 488 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 489 that the values passed as arguments n, ..., m must be non-NULL pointers. 490 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 491 #ifndef _GL_ARG_NONNULL 492 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 493 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 494 # else 495 # define _GL_ARG_NONNULL(params) 496 # endif 497 #endif 498 499 /* The definition of _GL_WARN_ON_USE is copied here. */ 500 /* A C macro for emitting warnings if a function is used. 501 Copyright (C) 2010-2020 Free Software Foundation, Inc. 502 503 This program is free software: you can redistribute it and/or modify it 504 under the terms of the GNU General Public License as published 505 by the Free Software Foundation; either version 3 of the License, or 506 (at your option) any later version. 507 508 This program is distributed in the hope that it will be useful, 509 but WITHOUT ANY WARRANTY; without even the implied warranty of 510 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 511 General Public License for more details. 512 513 You should have received a copy of the GNU General Public License 514 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 515 516 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 517 for FUNCTION which will then trigger a compiler warning containing 518 the text of "literal string" anywhere that function is called, if 519 supported by the compiler. If the compiler does not support this 520 feature, the macro expands to an unused extern declaration. 521 522 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 523 attribute used in _GL_WARN_ON_USE. If the compiler does not support 524 this feature, it expands to empty. 525 526 These macros are useful for marking a function as a potential 527 portability trap, with the intent that "literal string" include 528 instructions on the replacement function that should be used 529 instead. 530 _GL_WARN_ON_USE is for functions with 'extern' linkage. 531 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 532 linkage. 533 534 However, one of the reasons that a function is a portability trap is 535 if it has the wrong signature. Declaring FUNCTION with a different 536 signature in C is a compilation error, so this macro must use the 537 same type as any existing declaration so that programs that avoid 538 the problematic FUNCTION do not fail to compile merely because they 539 included a header that poisoned the function. But this implies that 540 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 541 have a declaration. Use of this macro implies that there must not 542 be any other macro hiding the declaration of FUNCTION; but 543 undefining FUNCTION first is part of the poisoning process anyway 544 (although for symbols that are provided only via a macro, the result 545 is a compilation error rather than a warning containing 546 "literal string"). Also note that in C++, it is only safe to use if 547 FUNCTION has no overloads. 548 549 For an example, it is possible to poison 'getline' by: 550 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 551 [getline]) in configure.ac, which potentially defines 552 HAVE_RAW_DECL_GETLINE 553 - adding this code to a header that wraps the system <stdio.h>: 554 #undef getline 555 #if HAVE_RAW_DECL_GETLINE 556 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 557 "not universally present; use the gnulib module getline"); 558 #endif 559 560 It is not possible to directly poison global variables. But it is 561 possible to write a wrapper accessor function, and poison that 562 (less common usage, like &environ, will cause a compilation error 563 rather than issue the nice warning, but the end result of informing 564 the developer about their portability problem is still achieved): 565 #if HAVE_RAW_DECL_ENVIRON 566 static char *** 567 rpl_environ (void) { return &environ; } 568 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 569 # undef environ 570 # define environ (*rpl_environ ()) 571 #endif 572 or better (avoiding contradictory use of 'static' and 'extern'): 573 #if HAVE_RAW_DECL_ENVIRON 574 static char *** 575 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 576 rpl_environ (void) { return &environ; } 577 # undef environ 578 # define environ (*rpl_environ ()) 579 #endif 580 */ 581 #ifndef _GL_WARN_ON_USE 582 583 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 584 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 585 # define _GL_WARN_ON_USE(function, message) \ 586 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 587 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 588 __attribute__ ((__warning__ (message))) 589 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 590 /* Verify the existence of the function. */ 591 # define _GL_WARN_ON_USE(function, message) \ 592 extern __typeof__ (function) function 593 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 594 # else /* Unsupported. */ 595 # define _GL_WARN_ON_USE(function, message) \ 596 _GL_WARN_EXTERN_C int _gl_warn_on_use 597 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 598 # endif 599 #endif 600 601 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 602 is like _GL_WARN_ON_USE (function, "string"), except that the function is 603 declared with the given prototype, consisting of return type, parameters, 604 and attributes. 605 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 606 not work in this case. */ 607 #ifndef _GL_WARN_ON_USE_CXX 608 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 609 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 610 extern rettype function parameters_and_attributes \ 611 __attribute__ ((__warning__ (msg))) 612 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 613 /* Verify the existence of the function. */ 614 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 615 extern rettype function parameters_and_attributes 616 # else /* Unsupported. */ 617 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 618 _GL_WARN_EXTERN_C int _gl_warn_on_use 619 # endif 620 #endif 621 622 /* _GL_WARN_EXTERN_C declaration; 623 performs the declaration with C linkage. */ 624 #ifndef _GL_WARN_EXTERN_C 625 # if defined __cplusplus 626 # define _GL_WARN_EXTERN_C extern "C" 627 # else 628 # define _GL_WARN_EXTERN_C extern 629 # endif 630 #endif 631 632 633 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ 634 #ifndef EXIT_SUCCESS 635 # define EXIT_SUCCESS 0 636 #endif 637 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere 638 with proper operation of xargs. */ 639 #ifndef EXIT_FAILURE 640 # define EXIT_FAILURE 1 641 #elif EXIT_FAILURE != 1 642 # undef EXIT_FAILURE 643 # define EXIT_FAILURE 1 644 #endif 645 646 647 #if 0 648 /* Terminate the current process with the given return code, without running 649 the 'atexit' handlers. */ 650 # if !1 651 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); 652 # endif 653 _GL_CXXALIAS_SYS (_Exit, void, (int status)); 654 _GL_CXXALIASWARN (_Exit); 655 #elif defined GNULIB_POSIXCHECK 656 # undef _Exit 657 # if HAVE_RAW_DECL__EXIT 658 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " 659 "use gnulib module _Exit for portability"); 660 # endif 661 #endif 662 663 664 #if 0 665 /* Parse a signed decimal integer. 666 Returns the value of the integer. Errors are not detected. */ 667 # if !1 668 _GL_FUNCDECL_SYS (atoll, long long, (const char *string) 669 _GL_ATTRIBUTE_PURE 670 _GL_ARG_NONNULL ((1))); 671 # endif 672 _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 673 _GL_CXXALIASWARN (atoll); 674 #elif defined GNULIB_POSIXCHECK 675 # undef atoll 676 # if HAVE_RAW_DECL_ATOLL 677 _GL_WARN_ON_USE (atoll, "atoll is unportable - " 678 "use gnulib module atoll for portability"); 679 # endif 680 #endif 681 682 #if 0 683 # if 0 684 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 685 # undef calloc 686 # define calloc rpl_calloc 687 # endif 688 _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); 689 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 690 # else 691 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 692 # endif 693 # if __GLIBC__ >= 2 694 _GL_CXXALIASWARN (calloc); 695 # endif 696 #elif defined GNULIB_POSIXCHECK 697 # undef calloc 698 /* Assume calloc is always declared. */ 699 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " 700 "use gnulib module calloc-posix for portability"); 701 #endif 702 703 #if 0 704 # if 0 705 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 706 # define canonicalize_file_name rpl_canonicalize_file_name 707 # endif 708 _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) 709 _GL_ARG_NONNULL ((1))); 710 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 711 # else 712 # if !1 713 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) 714 _GL_ARG_NONNULL ((1))); 715 # endif 716 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 717 # endif 718 _GL_CXXALIASWARN (canonicalize_file_name); 719 #elif defined GNULIB_POSIXCHECK 720 # undef canonicalize_file_name 721 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 722 _GL_WARN_ON_USE (canonicalize_file_name, 723 "canonicalize_file_name is unportable - " 724 "use gnulib module canonicalize-lgpl for portability"); 725 # endif 726 #endif 727 728 #if 0 729 /* Store max(NELEM,3) load average numbers in LOADAVG[]. 730 The three numbers are the load average of the last 1 minute, the last 5 731 minutes, and the last 15 minutes, respectively. 732 LOADAVG is an array of NELEM numbers. */ 733 # if !1 734 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) 735 _GL_ARG_NONNULL ((1))); 736 # endif 737 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); 738 _GL_CXXALIASWARN (getloadavg); 739 #elif defined GNULIB_POSIXCHECK 740 # undef getloadavg 741 # if HAVE_RAW_DECL_GETLOADAVG 742 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " 743 "use gnulib module getloadavg for portability"); 744 # endif 745 #endif 746 747 #if 0 748 /* Assuming *OPTIONP is a comma separated list of elements of the form 749 "token" or "token=value", getsubopt parses the first of these elements. 750 If the first element refers to a "token" that is member of the given 751 NULL-terminated array of tokens: 752 - It replaces the comma with a NUL byte, updates *OPTIONP to point past 753 the first option and the comma, sets *VALUEP to the value of the 754 element (or NULL if it doesn't contain an "=" sign), 755 - It returns the index of the "token" in the given array of tokens. 756 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. 757 For more details see the POSIX specification. 758 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ 759 # if !1 760 _GL_FUNCDECL_SYS (getsubopt, int, 761 (char **optionp, char *const *tokens, char **valuep) 762 _GL_ARG_NONNULL ((1, 2, 3))); 763 # endif 764 _GL_CXXALIAS_SYS (getsubopt, int, 765 (char **optionp, char *const *tokens, char **valuep)); 766 _GL_CXXALIASWARN (getsubopt); 767 #elif defined GNULIB_POSIXCHECK 768 # undef getsubopt 769 # if HAVE_RAW_DECL_GETSUBOPT 770 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " 771 "use gnulib module getsubopt for portability"); 772 # endif 773 #endif 774 775 #if 0 776 /* Change the ownership and access permission of the slave side of the 777 pseudo-terminal whose master side is specified by FD. */ 778 # if !1 779 _GL_FUNCDECL_SYS (grantpt, int, (int fd)); 780 # endif 781 _GL_CXXALIAS_SYS (grantpt, int, (int fd)); 782 _GL_CXXALIASWARN (grantpt); 783 #elif defined GNULIB_POSIXCHECK 784 # undef grantpt 785 # if HAVE_RAW_DECL_GRANTPT 786 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " 787 "use gnulib module grantpt for portability"); 788 # endif 789 #endif 790 791 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not 792 rely on GNU or POSIX semantics for malloc and realloc (for example, 793 by never specifying a zero size), so it does not need malloc or 794 realloc to be redefined. */ 795 #if 1 796 # if 0 797 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 798 || _GL_USE_STDLIB_ALLOC) 799 # undef malloc 800 # define malloc rpl_malloc 801 # endif 802 _GL_FUNCDECL_RPL (malloc, void *, (size_t size)); 803 _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 804 # else 805 _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 806 # endif 807 # if __GLIBC__ >= 2 808 _GL_CXXALIASWARN (malloc); 809 # endif 810 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 811 # undef malloc 812 /* Assume malloc is always declared. */ 813 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " 814 "use gnulib module malloc-posix for portability"); 815 #endif 816 817 /* Convert a multibyte character to a wide character. */ 818 #if 1 819 # if 0 820 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 821 # undef mbtowc 822 # define mbtowc rpl_mbtowc 823 # endif 824 _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 825 _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 826 # else 827 # if !1 828 _GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 829 # endif 830 _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 831 # endif 832 # if __GLIBC__ >= 2 833 _GL_CXXALIASWARN (mbtowc); 834 # endif 835 #elif defined GNULIB_POSIXCHECK 836 # undef mbtowc 837 # if HAVE_RAW_DECL_MBTOWC 838 _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " 839 "use gnulib module mbtowc for portability"); 840 # endif 841 #endif 842 843 #if 0 844 /* Create a unique temporary directory from TEMPLATE. 845 The last six characters of TEMPLATE must be "XXXXXX"; 846 they are replaced with a string that makes the directory name unique. 847 Returns TEMPLATE, or a null pointer if it cannot get a unique name. 848 The directory is created mode 700. */ 849 # if !1 850 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); 851 # endif 852 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); 853 _GL_CXXALIASWARN (mkdtemp); 854 #elif defined GNULIB_POSIXCHECK 855 # undef mkdtemp 856 # if HAVE_RAW_DECL_MKDTEMP 857 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " 858 "use gnulib module mkdtemp for portability"); 859 # endif 860 #endif 861 862 #if 0 863 /* Create a unique temporary file from TEMPLATE. 864 The last six characters of TEMPLATE must be "XXXXXX"; 865 they are replaced with a string that makes the file name unique. 866 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 867 and O_TEXT, O_BINARY (defined in "binary-io.h"). 868 The file is then created, with the specified flags, ensuring it didn't exist 869 before. 870 The file is created read-write (mask at least 0600 & ~umask), but it may be 871 world-readable and world-writable (mask 0666 & ~umask), depending on the 872 implementation. 873 Returns the open file descriptor if successful, otherwise -1 and errno 874 set. */ 875 # if !1 876 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) 877 _GL_ARG_NONNULL ((1))); 878 # endif 879 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); 880 _GL_CXXALIASWARN (mkostemp); 881 #elif defined GNULIB_POSIXCHECK 882 # undef mkostemp 883 # if HAVE_RAW_DECL_MKOSTEMP 884 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " 885 "use gnulib module mkostemp for portability"); 886 # endif 887 #endif 888 889 #if 0 890 /* Create a unique temporary file from TEMPLATE. 891 The last six characters of TEMPLATE before a suffix of length 892 SUFFIXLEN must be "XXXXXX"; 893 they are replaced with a string that makes the file name unique. 894 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 895 and O_TEXT, O_BINARY (defined in "binary-io.h"). 896 The file is then created, with the specified flags, ensuring it didn't exist 897 before. 898 The file is created read-write (mask at least 0600 & ~umask), but it may be 899 world-readable and world-writable (mask 0666 & ~umask), depending on the 900 implementation. 901 Returns the open file descriptor if successful, otherwise -1 and errno 902 set. */ 903 # if !1 904 _GL_FUNCDECL_SYS (mkostemps, int, 905 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 906 _GL_ARG_NONNULL ((1))); 907 # endif 908 _GL_CXXALIAS_SYS (mkostemps, int, 909 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 910 _GL_CXXALIASWARN (mkostemps); 911 #elif defined GNULIB_POSIXCHECK 912 # undef mkostemps 913 # if HAVE_RAW_DECL_MKOSTEMPS 914 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " 915 "use gnulib module mkostemps for portability"); 916 # endif 917 #endif 918 919 #if 0 920 /* Create a unique temporary file from TEMPLATE. 921 The last six characters of TEMPLATE must be "XXXXXX"; 922 they are replaced with a string that makes the file name unique. 923 The file is then created, ensuring it didn't exist before. 924 The file is created read-write (mask at least 0600 & ~umask), but it may be 925 world-readable and world-writable (mask 0666 & ~umask), depending on the 926 implementation. 927 Returns the open file descriptor if successful, otherwise -1 and errno 928 set. */ 929 # if 0 930 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 931 # define mkstemp rpl_mkstemp 932 # endif 933 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 934 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); 935 # else 936 # if ! 1 937 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 938 # endif 939 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); 940 # endif 941 _GL_CXXALIASWARN (mkstemp); 942 #elif defined GNULIB_POSIXCHECK 943 # undef mkstemp 944 # if HAVE_RAW_DECL_MKSTEMP 945 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " 946 "use gnulib module mkstemp for portability"); 947 # endif 948 #endif 949 950 #if 0 951 /* Create a unique temporary file from TEMPLATE. 952 The last six characters of TEMPLATE prior to a suffix of length 953 SUFFIXLEN must be "XXXXXX"; 954 they are replaced with a string that makes the file name unique. 955 The file is then created, ensuring it didn't exist before. 956 The file is created read-write (mask at least 0600 & ~umask), but it may be 957 world-readable and world-writable (mask 0666 & ~umask), depending on the 958 implementation. 959 Returns the open file descriptor if successful, otherwise -1 and errno 960 set. */ 961 # if !1 962 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) 963 _GL_ARG_NONNULL ((1))); 964 # endif 965 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); 966 _GL_CXXALIASWARN (mkstemps); 967 #elif defined GNULIB_POSIXCHECK 968 # undef mkstemps 969 # if HAVE_RAW_DECL_MKSTEMPS 970 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " 971 "use gnulib module mkstemps for portability"); 972 # endif 973 #endif 974 975 #if 0 976 /* Return an FD open to the master side of a pseudo-terminal. Flags should 977 include O_RDWR, and may also include O_NOCTTY. */ 978 # if !1 979 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); 980 # endif 981 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); 982 _GL_CXXALIASWARN (posix_openpt); 983 #elif defined GNULIB_POSIXCHECK 984 # undef posix_openpt 985 # if HAVE_RAW_DECL_POSIX_OPENPT 986 _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " 987 "use gnulib module posix_openpt for portability"); 988 # endif 989 #endif 990 991 #if 0 992 /* Return the pathname of the pseudo-terminal slave associated with 993 the master FD is open on, or NULL on errors. */ 994 # if 0 995 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 996 # undef ptsname 997 # define ptsname rpl_ptsname 998 # endif 999 _GL_FUNCDECL_RPL (ptsname, char *, (int fd)); 1000 _GL_CXXALIAS_RPL (ptsname, char *, (int fd)); 1001 # else 1002 # if !1 1003 _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 1004 # endif 1005 _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 1006 # endif 1007 _GL_CXXALIASWARN (ptsname); 1008 #elif defined GNULIB_POSIXCHECK 1009 # undef ptsname 1010 # if HAVE_RAW_DECL_PTSNAME 1011 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " 1012 "use gnulib module ptsname for portability"); 1013 # endif 1014 #endif 1015 1016 #if 0 1017 /* Set the pathname of the pseudo-terminal slave associated with 1018 the master FD is open on and return 0, or set errno and return 1019 non-zero on errors. */ 1020 # if 0 1021 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1022 # undef ptsname_r 1023 # define ptsname_r rpl_ptsname_r 1024 # endif 1025 _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 1026 _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 1027 # else 1028 # if !1 1029 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1030 # endif 1031 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1032 # endif 1033 _GL_CXXALIASWARN (ptsname_r); 1034 #elif defined GNULIB_POSIXCHECK 1035 # undef ptsname_r 1036 # if HAVE_RAW_DECL_PTSNAME_R 1037 _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " 1038 "use gnulib module ptsname_r for portability"); 1039 # endif 1040 #endif 1041 1042 #if IN_GREP_GNULIB_TESTS 1043 # if 1 1044 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1045 # undef putenv 1046 # define putenv rpl_putenv 1047 # endif 1048 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 1049 _GL_CXXALIAS_RPL (putenv, int, (char *string)); 1050 # else 1051 _GL_CXXALIAS_SYS (putenv, int, (char *string)); 1052 # endif 1053 _GL_CXXALIASWARN (putenv); 1054 #endif 1055 1056 #if 0 1057 /* Sort an array of NMEMB elements, starting at address BASE, each element 1058 occupying SIZE bytes, in ascending order according to the comparison 1059 function COMPARE. */ 1060 # if 0 1061 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1062 # undef qsort_r 1063 # define qsort_r rpl_qsort_r 1064 # endif 1065 _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1066 int (*compare) (void const *, void const *, 1067 void *), 1068 void *arg) _GL_ARG_NONNULL ((1, 4))); 1069 _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1070 int (*compare) (void const *, void const *, 1071 void *), 1072 void *arg)); 1073 # else 1074 # if !1 1075 _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1076 int (*compare) (void const *, void const *, 1077 void *), 1078 void *arg) _GL_ARG_NONNULL ((1, 4))); 1079 # endif 1080 _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1081 int (*compare) (void const *, void const *, 1082 void *), 1083 void *arg)); 1084 # endif 1085 _GL_CXXALIASWARN (qsort_r); 1086 #elif defined GNULIB_POSIXCHECK 1087 # undef qsort_r 1088 # if HAVE_RAW_DECL_QSORT_R 1089 _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " 1090 "use gnulib module qsort_r for portability"); 1091 # endif 1092 #endif 1093 1094 1095 #if 0 1096 # if !1 1097 # ifndef RAND_MAX 1098 # define RAND_MAX 2147483647 1099 # endif 1100 # endif 1101 #endif 1102 1103 1104 #if 0 1105 # if 0 1106 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1107 # undef random 1108 # define random rpl_random 1109 # endif 1110 _GL_FUNCDECL_RPL (random, long, (void)); 1111 _GL_CXXALIAS_RPL (random, long, (void)); 1112 # else 1113 # if !1 1114 _GL_FUNCDECL_SYS (random, long, (void)); 1115 # endif 1116 /* Need to cast, because on Haiku, the return type is 1117 int. */ 1118 _GL_CXXALIAS_SYS_CAST (random, long, (void)); 1119 # endif 1120 _GL_CXXALIASWARN (random); 1121 #elif defined GNULIB_POSIXCHECK 1122 # undef random 1123 # if HAVE_RAW_DECL_RANDOM 1124 _GL_WARN_ON_USE (random, "random is unportable - " 1125 "use gnulib module random for portability"); 1126 # endif 1127 #endif 1128 1129 #if 0 1130 # if 0 1131 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1132 # undef srandom 1133 # define srandom rpl_srandom 1134 # endif 1135 _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); 1136 _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); 1137 # else 1138 # if !1 1139 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 1140 # endif 1141 /* Need to cast, because on FreeBSD, the first parameter is 1142 unsigned long seed. */ 1143 _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); 1144 # endif 1145 _GL_CXXALIASWARN (srandom); 1146 #elif defined GNULIB_POSIXCHECK 1147 # undef srandom 1148 # if HAVE_RAW_DECL_SRANDOM 1149 _GL_WARN_ON_USE (srandom, "srandom is unportable - " 1150 "use gnulib module random for portability"); 1151 # endif 1152 #endif 1153 1154 #if 0 1155 # if 0 1156 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1157 # undef initstate 1158 # define initstate rpl_initstate 1159 # endif 1160 _GL_FUNCDECL_RPL (initstate, char *, 1161 (unsigned int seed, char *buf, size_t buf_size) 1162 _GL_ARG_NONNULL ((2))); 1163 _GL_CXXALIAS_RPL (initstate, char *, 1164 (unsigned int seed, char *buf, size_t buf_size)); 1165 # else 1166 # if !1 || !1 1167 _GL_FUNCDECL_SYS (initstate, char *, 1168 (unsigned int seed, char *buf, size_t buf_size) 1169 _GL_ARG_NONNULL ((2))); 1170 # endif 1171 /* Need to cast, because on FreeBSD, the first parameter is 1172 unsigned long seed. */ 1173 _GL_CXXALIAS_SYS_CAST (initstate, char *, 1174 (unsigned int seed, char *buf, size_t buf_size)); 1175 # endif 1176 _GL_CXXALIASWARN (initstate); 1177 #elif defined GNULIB_POSIXCHECK 1178 # undef initstate 1179 # if HAVE_RAW_DECL_INITSTATE 1180 _GL_WARN_ON_USE (initstate, "initstate is unportable - " 1181 "use gnulib module random for portability"); 1182 # endif 1183 #endif 1184 1185 #if 0 1186 # if 0 1187 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1188 # undef setstate 1189 # define setstate rpl_setstate 1190 # endif 1191 _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1192 _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); 1193 # else 1194 # if !1 || !1 1195 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1196 # endif 1197 /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter 1198 is const char *arg_state. */ 1199 _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); 1200 # endif 1201 _GL_CXXALIASWARN (setstate); 1202 #elif defined GNULIB_POSIXCHECK 1203 # undef setstate 1204 # if HAVE_RAW_DECL_SETSTATE 1205 _GL_WARN_ON_USE (setstate, "setstate is unportable - " 1206 "use gnulib module random for portability"); 1207 # endif 1208 #endif 1209 1210 1211 #if 0 1212 # if 0 1213 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1214 # undef random_r 1215 # define random_r rpl_random_r 1216 # endif 1217 _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) 1218 _GL_ARG_NONNULL ((1, 2))); 1219 _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); 1220 # else 1221 # if !1 1222 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 1223 _GL_ARG_NONNULL ((1, 2))); 1224 # endif 1225 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 1226 # endif 1227 _GL_CXXALIASWARN (random_r); 1228 #elif defined GNULIB_POSIXCHECK 1229 # undef random_r 1230 # if HAVE_RAW_DECL_RANDOM_R 1231 _GL_WARN_ON_USE (random_r, "random_r is unportable - " 1232 "use gnulib module random_r for portability"); 1233 # endif 1234 #endif 1235 1236 #if 0 1237 # if 0 1238 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1239 # undef srandom_r 1240 # define srandom_r rpl_srandom_r 1241 # endif 1242 _GL_FUNCDECL_RPL (srandom_r, int, 1243 (unsigned int seed, struct random_data *rand_state) 1244 _GL_ARG_NONNULL ((2))); 1245 _GL_CXXALIAS_RPL (srandom_r, int, 1246 (unsigned int seed, struct random_data *rand_state)); 1247 # else 1248 # if !1 1249 _GL_FUNCDECL_SYS (srandom_r, int, 1250 (unsigned int seed, struct random_data *rand_state) 1251 _GL_ARG_NONNULL ((2))); 1252 # endif 1253 _GL_CXXALIAS_SYS (srandom_r, int, 1254 (unsigned int seed, struct random_data *rand_state)); 1255 # endif 1256 _GL_CXXALIASWARN (srandom_r); 1257 #elif defined GNULIB_POSIXCHECK 1258 # undef srandom_r 1259 # if HAVE_RAW_DECL_SRANDOM_R 1260 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " 1261 "use gnulib module random_r for portability"); 1262 # endif 1263 #endif 1264 1265 #if 0 1266 # if 0 1267 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1268 # undef initstate_r 1269 # define initstate_r rpl_initstate_r 1270 # endif 1271 _GL_FUNCDECL_RPL (initstate_r, int, 1272 (unsigned int seed, char *buf, size_t buf_size, 1273 struct random_data *rand_state) 1274 _GL_ARG_NONNULL ((2, 4))); 1275 _GL_CXXALIAS_RPL (initstate_r, int, 1276 (unsigned int seed, char *buf, size_t buf_size, 1277 struct random_data *rand_state)); 1278 # else 1279 # if !1 1280 _GL_FUNCDECL_SYS (initstate_r, int, 1281 (unsigned int seed, char *buf, size_t buf_size, 1282 struct random_data *rand_state) 1283 _GL_ARG_NONNULL ((2, 4))); 1284 # endif 1285 /* Need to cast, because on Haiku, the third parameter is 1286 unsigned long buf_size. */ 1287 _GL_CXXALIAS_SYS_CAST (initstate_r, int, 1288 (unsigned int seed, char *buf, size_t buf_size, 1289 struct random_data *rand_state)); 1290 # endif 1291 _GL_CXXALIASWARN (initstate_r); 1292 #elif defined GNULIB_POSIXCHECK 1293 # undef initstate_r 1294 # if HAVE_RAW_DECL_INITSTATE_R 1295 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " 1296 "use gnulib module random_r for portability"); 1297 # endif 1298 #endif 1299 1300 #if 0 1301 # if 0 1302 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1303 # undef setstate_r 1304 # define setstate_r rpl_setstate_r 1305 # endif 1306 _GL_FUNCDECL_RPL (setstate_r, int, 1307 (char *arg_state, struct random_data *rand_state) 1308 _GL_ARG_NONNULL ((1, 2))); 1309 _GL_CXXALIAS_RPL (setstate_r, int, 1310 (char *arg_state, struct random_data *rand_state)); 1311 # else 1312 # if !1 1313 _GL_FUNCDECL_SYS (setstate_r, int, 1314 (char *arg_state, struct random_data *rand_state) 1315 _GL_ARG_NONNULL ((1, 2))); 1316 # endif 1317 /* Need to cast, because on Haiku, the first parameter is 1318 void *arg_state. */ 1319 _GL_CXXALIAS_SYS_CAST (setstate_r, int, 1320 (char *arg_state, struct random_data *rand_state)); 1321 # endif 1322 _GL_CXXALIASWARN (setstate_r); 1323 #elif defined GNULIB_POSIXCHECK 1324 # undef setstate_r 1325 # if HAVE_RAW_DECL_SETSTATE_R 1326 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " 1327 "use gnulib module random_r for portability"); 1328 # endif 1329 #endif 1330 1331 1332 #if 1 1333 # if 0 1334 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 1335 || _GL_USE_STDLIB_ALLOC) 1336 # undef realloc 1337 # define realloc rpl_realloc 1338 # endif 1339 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); 1340 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 1341 # else 1342 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 1343 # endif 1344 # if __GLIBC__ >= 2 1345 _GL_CXXALIASWARN (realloc); 1346 # endif 1347 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 1348 # undef realloc 1349 /* Assume realloc is always declared. */ 1350 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " 1351 "use gnulib module realloc-posix for portability"); 1352 #endif 1353 1354 1355 #if 0 1356 # if ! 1 1357 _GL_FUNCDECL_SYS (reallocarray, void *, 1358 (void *ptr, size_t nmemb, size_t size)); 1359 # endif 1360 _GL_CXXALIAS_SYS (reallocarray, void *, 1361 (void *ptr, size_t nmemb, size_t size)); 1362 _GL_CXXALIASWARN (reallocarray); 1363 #elif defined GNULIB_POSIXCHECK 1364 # undef reallocarray 1365 # if HAVE_RAW_DECL_REALLOCARRAY 1366 _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " 1367 "use gnulib module reallocarray for portability"); 1368 # endif 1369 #endif 1370 1371 #if 0 1372 # if 0 1373 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1374 # define realpath rpl_realpath 1375 # endif 1376 _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) 1377 _GL_ARG_NONNULL ((1))); 1378 _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); 1379 # else 1380 # if !1 1381 _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) 1382 _GL_ARG_NONNULL ((1))); 1383 # endif 1384 _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); 1385 # endif 1386 _GL_CXXALIASWARN (realpath); 1387 #elif defined GNULIB_POSIXCHECK 1388 # undef realpath 1389 # if HAVE_RAW_DECL_REALPATH 1390 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " 1391 "canonicalize or canonicalize-lgpl for portability"); 1392 # endif 1393 #endif 1394 1395 #if 0 1396 /* Test a user response to a question. 1397 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ 1398 # if !1 1399 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); 1400 # endif 1401 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); 1402 _GL_CXXALIASWARN (rpmatch); 1403 #elif defined GNULIB_POSIXCHECK 1404 # undef rpmatch 1405 # if HAVE_RAW_DECL_RPMATCH 1406 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " 1407 "use gnulib module rpmatch for portability"); 1408 # endif 1409 #endif 1410 1411 #if 0 1412 /* Look up NAME in the environment, returning 0 in insecure situations. */ 1413 # if !1 1414 _GL_FUNCDECL_SYS (secure_getenv, char *, 1415 (char const *name) _GL_ARG_NONNULL ((1))); 1416 # endif 1417 _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); 1418 _GL_CXXALIASWARN (secure_getenv); 1419 #elif defined GNULIB_POSIXCHECK 1420 # undef secure_getenv 1421 # if HAVE_RAW_DECL_SECURE_GETENV 1422 _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " 1423 "use gnulib module secure_getenv for portability"); 1424 # endif 1425 #endif 1426 1427 #if IN_GREP_GNULIB_TESTS 1428 /* Set NAME to VALUE in the environment. 1429 If REPLACE is nonzero, overwrite an existing value. */ 1430 # if 0 1431 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1432 # undef setenv 1433 # define setenv rpl_setenv 1434 # endif 1435 _GL_FUNCDECL_RPL (setenv, int, 1436 (const char *name, const char *value, int replace) 1437 _GL_ARG_NONNULL ((1))); 1438 _GL_CXXALIAS_RPL (setenv, int, 1439 (const char *name, const char *value, int replace)); 1440 # else 1441 # if !1 1442 _GL_FUNCDECL_SYS (setenv, int, 1443 (const char *name, const char *value, int replace) 1444 _GL_ARG_NONNULL ((1))); 1445 # endif 1446 _GL_CXXALIAS_SYS (setenv, int, 1447 (const char *name, const char *value, int replace)); 1448 # endif 1449 # if !(0 && !1) 1450 _GL_CXXALIASWARN (setenv); 1451 # endif 1452 #elif defined GNULIB_POSIXCHECK 1453 # undef setenv 1454 # if HAVE_RAW_DECL_SETENV 1455 _GL_WARN_ON_USE (setenv, "setenv is unportable - " 1456 "use gnulib module setenv for portability"); 1457 # endif 1458 #endif 1459 1460 #if 0 1461 /* Parse a double from STRING, updating ENDP if appropriate. */ 1462 # if 0 1463 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1464 # define strtod rpl_strtod 1465 # endif 1466 # define GNULIB_defined_strtod_function 1 1467 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) 1468 _GL_ARG_NONNULL ((1))); 1469 _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); 1470 # else 1471 # if !1 1472 _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) 1473 _GL_ARG_NONNULL ((1))); 1474 # endif 1475 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); 1476 # endif 1477 # if __GLIBC__ >= 2 1478 _GL_CXXALIASWARN (strtod); 1479 # endif 1480 #elif defined GNULIB_POSIXCHECK 1481 # undef strtod 1482 # if HAVE_RAW_DECL_STRTOD 1483 _GL_WARN_ON_USE (strtod, "strtod is unportable - " 1484 "use gnulib module strtod for portability"); 1485 # endif 1486 #endif 1487 1488 #if 0 1489 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ 1490 # if 0 1491 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1492 # define strtold rpl_strtold 1493 # endif 1494 # define GNULIB_defined_strtold_function 1 1495 _GL_FUNCDECL_RPL (strtold, long double, (const char *str, char **endp) 1496 _GL_ARG_NONNULL ((1))); 1497 _GL_CXXALIAS_RPL (strtold, long double, (const char *str, char **endp)); 1498 # else 1499 # if !1 1500 _GL_FUNCDECL_SYS (strtold, long double, (const char *str, char **endp) 1501 _GL_ARG_NONNULL ((1))); 1502 # endif 1503 _GL_CXXALIAS_SYS (strtold, long double, (const char *str, char **endp)); 1504 # endif 1505 _GL_CXXALIASWARN (strtold); 1506 #elif defined GNULIB_POSIXCHECK 1507 # undef strtold 1508 # if HAVE_RAW_DECL_STRTOLD 1509 _GL_WARN_ON_USE (strtold, "strtold is unportable - " 1510 "use gnulib module strtold for portability"); 1511 # endif 1512 #endif 1513 1514 #if 1 1515 /* Parse a signed integer whose textual representation starts at STRING. 1516 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1517 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 1518 "0x"). 1519 If ENDPTR is not NULL, the address of the first byte after the integer is 1520 stored in *ENDPTR. 1521 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set 1522 to ERANGE. */ 1523 # if !1 1524 _GL_FUNCDECL_SYS (strtoll, long long, 1525 (const char *string, char **endptr, int base) 1526 _GL_ARG_NONNULL ((1))); 1527 # endif 1528 _GL_CXXALIAS_SYS (strtoll, long long, 1529 (const char *string, char **endptr, int base)); 1530 _GL_CXXALIASWARN (strtoll); 1531 #elif defined GNULIB_POSIXCHECK 1532 # undef strtoll 1533 # if HAVE_RAW_DECL_STRTOLL 1534 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " 1535 "use gnulib module strtoll for portability"); 1536 # endif 1537 #endif 1538 1539 #if 1 1540 /* Parse an unsigned integer whose textual representation starts at STRING. 1541 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1542 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 1543 "0x"). 1544 If ENDPTR is not NULL, the address of the first byte after the integer is 1545 stored in *ENDPTR. 1546 Upon overflow, the return value is ULLONG_MAX, and errno is set to 1547 ERANGE. */ 1548 # if !1 1549 _GL_FUNCDECL_SYS (strtoull, unsigned long long, 1550 (const char *string, char **endptr, int base) 1551 _GL_ARG_NONNULL ((1))); 1552 # endif 1553 _GL_CXXALIAS_SYS (strtoull, unsigned long long, 1554 (const char *string, char **endptr, int base)); 1555 _GL_CXXALIASWARN (strtoull); 1556 #elif defined GNULIB_POSIXCHECK 1557 # undef strtoull 1558 # if HAVE_RAW_DECL_STRTOULL 1559 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - " 1560 "use gnulib module strtoull for portability"); 1561 # endif 1562 #endif 1563 1564 #if 0 1565 /* Unlock the slave side of the pseudo-terminal whose master side is specified 1566 by FD, so that it can be opened. */ 1567 # if !1 1568 _GL_FUNCDECL_SYS (unlockpt, int, (int fd)); 1569 # endif 1570 _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); 1571 _GL_CXXALIASWARN (unlockpt); 1572 #elif defined GNULIB_POSIXCHECK 1573 # undef unlockpt 1574 # if HAVE_RAW_DECL_UNLOCKPT 1575 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " 1576 "use gnulib module unlockpt for portability"); 1577 # endif 1578 #endif 1579 1580 #if IN_GREP_GNULIB_TESTS 1581 /* Remove the variable NAME from the environment. */ 1582 # if 0 1583 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1584 # undef unsetenv 1585 # define unsetenv rpl_unsetenv 1586 # endif 1587 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1588 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 1589 # else 1590 # if !1 1591 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1592 # endif 1593 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 1594 # endif 1595 # if !(0 && !1) 1596 _GL_CXXALIASWARN (unsetenv); 1597 # endif 1598 #elif defined GNULIB_POSIXCHECK 1599 # undef unsetenv 1600 # if HAVE_RAW_DECL_UNSETENV 1601 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " 1602 "use gnulib module unsetenv for portability"); 1603 # endif 1604 #endif 1605 1606 /* Convert a wide character to a multibyte character. */ 1607 #if 1 1608 # if 0 1609 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1610 # undef wctomb 1611 # define wctomb rpl_wctomb 1612 # endif 1613 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); 1614 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); 1615 # else 1616 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 1617 # endif 1618 # if __GLIBC__ >= 2 1619 _GL_CXXALIASWARN (wctomb); 1620 # endif 1621 #endif 1622 1623 1624 #endif /* _GL_STDLIB_H */ 1625 #endif /* _GL_STDLIB_H */ 1626 #endif 1627