1 /* A GNU-like <stdlib.h>. 2 3 Copyright (C) 1995, 2001-2004, 2006-2021 Free Software Foundation, Inc. 4 5 This file is free software: you can redistribute it and/or modify 6 it under the terms of the GNU Lesser General Public License as 7 published by the Free Software Foundation; either version 2.1 of the 8 License, or (at your option) any later version. 9 10 This file is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public License 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 17 18 #if __GNUC__ >= 3 19 @PRAGMA_SYSTEM_HEADER@ 20 #endif 21 @PRAGMA_COLUMNS@ 22 23 #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc 24 /* Special invocation conventions inside some gnulib header files, 25 and inside some glibc header files, respectively. */ 26 27 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ 28 29 #else 30 /* Normal invocation convention. */ 31 32 #ifndef _@GUARD_PREFIX@_STDLIB_H 33 34 /* The include_next requires a split double-inclusion guard. */ 35 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ 36 37 #ifndef _@GUARD_PREFIX@_STDLIB_H 38 #define _@GUARD_PREFIX@_STDLIB_H 39 40 /* NetBSD 5.0 mis-defines NULL. */ 41 #include <stddef.h> 42 43 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */ 44 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS 45 # include <sys/wait.h> 46 #endif 47 48 /* Solaris declares getloadavg() in <sys/loadavg.h>. */ 49 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ 50 /* OpenIndiana has a bug: <sys/time.h> must be included before 51 <sys/loadavg.h>. */ 52 # include <sys/time.h> 53 # include <sys/loadavg.h> 54 #endif 55 56 /* Native Windows platforms declare _mktemp() in <io.h>. */ 57 #if defined _WIN32 && !defined __CYGWIN__ 58 # include <io.h> 59 #endif 60 61 #if @GNULIB_RANDOM_R@ 62 63 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included 64 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need 65 'struct random_data'. */ 66 # if @HAVE_RANDOM_H@ 67 # include <random.h> 68 # endif 69 70 # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ 71 # include <stdint.h> 72 # endif 73 74 # if !@HAVE_STRUCT_RANDOM_DATA@ 75 /* Define 'struct random_data'. 76 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */ 77 # if !GNULIB_defined_struct_random_data 78 struct random_data 79 { 80 int32_t *fptr; /* Front pointer. */ 81 int32_t *rptr; /* Rear pointer. */ 82 int32_t *state; /* Array of state values. */ 83 int rand_type; /* Type of random number generator. */ 84 int rand_deg; /* Degree of random number generator. */ 85 int rand_sep; /* Distance between front and rear. */ 86 int32_t *end_ptr; /* Pointer behind state table. */ 87 }; 88 # define GNULIB_defined_struct_random_data 1 89 # endif 90 # endif 91 #endif 92 93 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__) 94 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */ 95 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */ 96 /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */ 97 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ 98 /* But avoid namespace pollution on glibc systems and native Windows. */ 99 # include <unistd.h> 100 #endif 101 102 /* The __attribute__ feature is available in gcc versions 2.5 and later. 103 The attribute __pure__ was added in gcc 2.96. */ 104 #ifndef _GL_ATTRIBUTE_PURE 105 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ 106 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 107 # else 108 # define _GL_ATTRIBUTE_PURE /* empty */ 109 # endif 110 #endif 111 112 /* The definition of _Noreturn is copied here. */ 113 114 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 115 116 /* The definition of _GL_ARG_NONNULL is copied here. */ 117 118 /* The definition of _GL_WARN_ON_USE is copied here. */ 119 120 121 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ 122 #ifndef EXIT_SUCCESS 123 # define EXIT_SUCCESS 0 124 #endif 125 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere 126 with proper operation of xargs. */ 127 #ifndef EXIT_FAILURE 128 # define EXIT_FAILURE 1 129 #elif EXIT_FAILURE != 1 130 # undef EXIT_FAILURE 131 # define EXIT_FAILURE 1 132 #endif 133 134 135 #if @GNULIB__EXIT@ 136 /* Terminate the current process with the given return code, without running 137 the 'atexit' handlers. */ 138 # if !@HAVE__EXIT@ 139 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); 140 # endif 141 _GL_CXXALIAS_SYS (_Exit, void, (int status)); 142 _GL_CXXALIASWARN (_Exit); 143 #elif defined GNULIB_POSIXCHECK 144 # undef _Exit 145 # if HAVE_RAW_DECL__EXIT 146 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " 147 "use gnulib module _Exit for portability"); 148 # endif 149 #endif 150 151 152 /* Allocate memory with indefinite extent and specified alignment. */ 153 #if @GNULIB_ALIGNED_ALLOC@ 154 # if @REPLACE_ALIGNED_ALLOC@ 155 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 156 # undef aligned_alloc 157 # define aligned_alloc rpl_aligned_alloc 158 # endif 159 _GL_FUNCDECL_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); 160 _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); 161 # else 162 # if @HAVE_ALIGNED_ALLOC@ 163 _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); 164 # endif 165 # endif 166 # if @HAVE_ALIGNED_ALLOC@ 167 _GL_CXXALIASWARN (aligned_alloc); 168 # endif 169 #elif defined GNULIB_POSIXCHECK 170 # undef aligned_alloc 171 # if HAVE_RAW_DECL_ALIGNED_ALLOC 172 _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " 173 "use gnulib module aligned_alloc for portability"); 174 # endif 175 #endif 176 177 #if @GNULIB_ATOLL@ 178 /* Parse a signed decimal integer. 179 Returns the value of the integer. Errors are not detected. */ 180 # if !@HAVE_ATOLL@ 181 _GL_FUNCDECL_SYS (atoll, long long, (const char *string) 182 _GL_ATTRIBUTE_PURE 183 _GL_ARG_NONNULL ((1))); 184 # endif 185 _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 186 _GL_CXXALIASWARN (atoll); 187 #elif defined GNULIB_POSIXCHECK 188 # undef atoll 189 # if HAVE_RAW_DECL_ATOLL 190 _GL_WARN_ON_USE (atoll, "atoll is unportable - " 191 "use gnulib module atoll for portability"); 192 # endif 193 #endif 194 195 #if @GNULIB_CALLOC_POSIX@ 196 # if @REPLACE_CALLOC@ 197 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 198 # undef calloc 199 # define calloc rpl_calloc 200 # endif 201 _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); 202 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 203 # else 204 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 205 # endif 206 # if __GLIBC__ >= 2 207 _GL_CXXALIASWARN (calloc); 208 # endif 209 #elif defined GNULIB_POSIXCHECK 210 # undef calloc 211 /* Assume calloc is always declared. */ 212 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " 213 "use gnulib module calloc-posix for portability"); 214 #endif 215 216 #if @GNULIB_CANONICALIZE_FILE_NAME@ 217 # if @REPLACE_CANONICALIZE_FILE_NAME@ 218 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 219 # define canonicalize_file_name rpl_canonicalize_file_name 220 # endif 221 _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) 222 _GL_ARG_NONNULL ((1))); 223 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 224 # else 225 # if !@HAVE_CANONICALIZE_FILE_NAME@ 226 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) 227 _GL_ARG_NONNULL ((1))); 228 # endif 229 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 230 # endif 231 # ifndef GNULIB_defined_canonicalize_file_name 232 # define GNULIB_defined_canonicalize_file_name \ 233 (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@) 234 # endif 235 _GL_CXXALIASWARN (canonicalize_file_name); 236 #elif defined GNULIB_POSIXCHECK 237 # undef canonicalize_file_name 238 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 239 _GL_WARN_ON_USE (canonicalize_file_name, 240 "canonicalize_file_name is unportable - " 241 "use gnulib module canonicalize-lgpl for portability"); 242 # endif 243 #endif 244 245 #if @GNULIB_MDA_ECVT@ 246 /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not 247 required. In C++ with GNULIB_NAMESPACE, avoid differences between 248 platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have 249 it. */ 250 # if defined _WIN32 && !defined __CYGWIN__ 251 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 252 # undef ecvt 253 # define ecvt _ecvt 254 # endif 255 _GL_CXXALIAS_MDA (ecvt, char *, 256 (double number, int ndigits, int *decptp, int *signp)); 257 # else 258 # if @HAVE_DECL_ECVT@ 259 _GL_CXXALIAS_SYS (ecvt, char *, 260 (double number, int ndigits, int *decptp, int *signp)); 261 # endif 262 # endif 263 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@ 264 _GL_CXXALIASWARN (ecvt); 265 # endif 266 #endif 267 268 #if @GNULIB_MDA_FCVT@ 269 /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not 270 required. In C++ with GNULIB_NAMESPACE, avoid differences between 271 platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have 272 it. */ 273 # if defined _WIN32 && !defined __CYGWIN__ 274 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 275 # undef fcvt 276 # define fcvt _fcvt 277 # endif 278 _GL_CXXALIAS_MDA (fcvt, char *, 279 (double number, int ndigits, int *decptp, int *signp)); 280 # else 281 # if @HAVE_DECL_FCVT@ 282 _GL_CXXALIAS_SYS (fcvt, char *, 283 (double number, int ndigits, int *decptp, int *signp)); 284 # endif 285 # endif 286 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@ 287 _GL_CXXALIASWARN (fcvt); 288 # endif 289 #endif 290 291 #if @GNULIB_FREE_POSIX@ 292 # if @REPLACE_FREE@ 293 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 294 # undef free 295 # define free rpl_free 296 # endif 297 _GL_FUNCDECL_RPL (free, void, (void *ptr)); 298 _GL_CXXALIAS_RPL (free, void, (void *ptr)); 299 # else 300 _GL_CXXALIAS_SYS (free, void, (void *ptr)); 301 # endif 302 # if __GLIBC__ >= 2 303 _GL_CXXALIASWARN (free); 304 # endif 305 #elif defined GNULIB_POSIXCHECK 306 # undef free 307 /* Assume free is always declared. */ 308 _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " 309 "use gnulib module free for portability"); 310 #endif 311 312 #if @GNULIB_MDA_GCVT@ 313 /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not 314 required. In C++ with GNULIB_NAMESPACE, avoid differences between 315 platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have 316 it. */ 317 # if defined _WIN32 && !defined __CYGWIN__ 318 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 319 # undef gcvt 320 # define gcvt _gcvt 321 # endif 322 _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf)); 323 # else 324 # if @HAVE_DECL_GCVT@ 325 _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf)); 326 # endif 327 # endif 328 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@ 329 _GL_CXXALIASWARN (gcvt); 330 # endif 331 #endif 332 333 #if @GNULIB_GETLOADAVG@ 334 /* Store max(NELEM,3) load average numbers in LOADAVG[]. 335 The three numbers are the load average of the last 1 minute, the last 5 336 minutes, and the last 15 minutes, respectively. 337 LOADAVG is an array of NELEM numbers. */ 338 # if !@HAVE_DECL_GETLOADAVG@ 339 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) 340 _GL_ARG_NONNULL ((1))); 341 # endif 342 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); 343 _GL_CXXALIASWARN (getloadavg); 344 #elif defined GNULIB_POSIXCHECK 345 # undef getloadavg 346 # if HAVE_RAW_DECL_GETLOADAVG 347 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " 348 "use gnulib module getloadavg for portability"); 349 # endif 350 #endif 351 352 #if @GNULIB_GETSUBOPT@ 353 /* Assuming *OPTIONP is a comma separated list of elements of the form 354 "token" or "token=value", getsubopt parses the first of these elements. 355 If the first element refers to a "token" that is member of the given 356 NULL-terminated array of tokens: 357 - It replaces the comma with a NUL byte, updates *OPTIONP to point past 358 the first option and the comma, sets *VALUEP to the value of the 359 element (or NULL if it doesn't contain an "=" sign), 360 - It returns the index of the "token" in the given array of tokens. 361 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. 362 For more details see the POSIX specification. 363 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ 364 # if !@HAVE_GETSUBOPT@ 365 _GL_FUNCDECL_SYS (getsubopt, int, 366 (char **optionp, char *const *tokens, char **valuep) 367 _GL_ARG_NONNULL ((1, 2, 3))); 368 # endif 369 _GL_CXXALIAS_SYS (getsubopt, int, 370 (char **optionp, char *const *tokens, char **valuep)); 371 _GL_CXXALIASWARN (getsubopt); 372 #elif defined GNULIB_POSIXCHECK 373 # undef getsubopt 374 # if HAVE_RAW_DECL_GETSUBOPT 375 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " 376 "use gnulib module getsubopt for portability"); 377 # endif 378 #endif 379 380 #if @GNULIB_GRANTPT@ 381 /* Change the ownership and access permission of the slave side of the 382 pseudo-terminal whose master side is specified by FD. */ 383 # if !@HAVE_GRANTPT@ 384 _GL_FUNCDECL_SYS (grantpt, int, (int fd)); 385 # endif 386 _GL_CXXALIAS_SYS (grantpt, int, (int fd)); 387 _GL_CXXALIASWARN (grantpt); 388 #elif defined GNULIB_POSIXCHECK 389 # undef grantpt 390 # if HAVE_RAW_DECL_GRANTPT 391 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " 392 "use gnulib module grantpt for portability"); 393 # endif 394 #endif 395 396 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not 397 rely on GNU or POSIX semantics for malloc and realloc (for example, 398 by never specifying a zero size), so it does not need malloc or 399 realloc to be redefined. */ 400 #if @GNULIB_MALLOC_POSIX@ 401 # if @REPLACE_MALLOC@ 402 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 403 || _GL_USE_STDLIB_ALLOC) 404 # undef malloc 405 # define malloc rpl_malloc 406 # endif 407 _GL_FUNCDECL_RPL (malloc, void *, (size_t size)); 408 _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 409 # else 410 _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 411 # endif 412 # if __GLIBC__ >= 2 413 _GL_CXXALIASWARN (malloc); 414 # endif 415 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 416 # undef malloc 417 /* Assume malloc is always declared. */ 418 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " 419 "use gnulib module malloc-posix for portability"); 420 #endif 421 422 /* Convert a multibyte character to a wide character. */ 423 #if @GNULIB_MBTOWC@ 424 # if @REPLACE_MBTOWC@ 425 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 426 # undef mbtowc 427 # define mbtowc rpl_mbtowc 428 # endif 429 _GL_FUNCDECL_RPL (mbtowc, int, 430 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 431 _GL_CXXALIAS_RPL (mbtowc, int, 432 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 433 # else 434 # if !@HAVE_MBTOWC@ 435 _GL_FUNCDECL_SYS (mbtowc, int, 436 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 437 # endif 438 _GL_CXXALIAS_SYS (mbtowc, int, 439 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 440 # endif 441 # if __GLIBC__ >= 2 442 _GL_CXXALIASWARN (mbtowc); 443 # endif 444 #elif defined GNULIB_POSIXCHECK 445 # undef mbtowc 446 # if HAVE_RAW_DECL_MBTOWC 447 _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " 448 "use gnulib module mbtowc for portability"); 449 # endif 450 #endif 451 452 #if @GNULIB_MKDTEMP@ 453 /* Create a unique temporary directory from TEMPLATE. 454 The last six characters of TEMPLATE must be "XXXXXX"; 455 they are replaced with a string that makes the directory name unique. 456 Returns TEMPLATE, or a null pointer if it cannot get a unique name. 457 The directory is created mode 700. */ 458 # if !@HAVE_MKDTEMP@ 459 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); 460 # endif 461 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); 462 _GL_CXXALIASWARN (mkdtemp); 463 #elif defined GNULIB_POSIXCHECK 464 # undef mkdtemp 465 # if HAVE_RAW_DECL_MKDTEMP 466 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " 467 "use gnulib module mkdtemp for portability"); 468 # endif 469 #endif 470 471 #if @GNULIB_MKOSTEMP@ 472 /* Create a unique temporary file from TEMPLATE. 473 The last six characters of TEMPLATE must be "XXXXXX"; 474 they are replaced with a string that makes the file name unique. 475 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 476 and O_TEXT, O_BINARY (defined in "binary-io.h"). 477 The file is then created, with the specified flags, ensuring it didn't exist 478 before. 479 The file is created read-write (mask at least 0600 & ~umask), but it may be 480 world-readable and world-writable (mask 0666 & ~umask), depending on the 481 implementation. 482 Returns the open file descriptor if successful, otherwise -1 and errno 483 set. */ 484 # if !@HAVE_MKOSTEMP@ 485 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) 486 _GL_ARG_NONNULL ((1))); 487 # endif 488 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); 489 _GL_CXXALIASWARN (mkostemp); 490 #elif defined GNULIB_POSIXCHECK 491 # undef mkostemp 492 # if HAVE_RAW_DECL_MKOSTEMP 493 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " 494 "use gnulib module mkostemp for portability"); 495 # endif 496 #endif 497 498 #if @GNULIB_MKOSTEMPS@ 499 /* Create a unique temporary file from TEMPLATE. 500 The last six characters of TEMPLATE before a suffix of length 501 SUFFIXLEN must be "XXXXXX"; 502 they are replaced with a string that makes the file name unique. 503 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 504 and O_TEXT, O_BINARY (defined in "binary-io.h"). 505 The file is then created, with the specified flags, ensuring it didn't exist 506 before. 507 The file is created read-write (mask at least 0600 & ~umask), but it may be 508 world-readable and world-writable (mask 0666 & ~umask), depending on the 509 implementation. 510 Returns the open file descriptor if successful, otherwise -1 and errno 511 set. */ 512 # if !@HAVE_MKOSTEMPS@ 513 _GL_FUNCDECL_SYS (mkostemps, int, 514 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 515 _GL_ARG_NONNULL ((1))); 516 # endif 517 _GL_CXXALIAS_SYS (mkostemps, int, 518 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 519 _GL_CXXALIASWARN (mkostemps); 520 #elif defined GNULIB_POSIXCHECK 521 # undef mkostemps 522 # if HAVE_RAW_DECL_MKOSTEMPS 523 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " 524 "use gnulib module mkostemps for portability"); 525 # endif 526 #endif 527 528 #if @GNULIB_MKSTEMP@ 529 /* Create a unique temporary file from TEMPLATE. 530 The last six characters of TEMPLATE must be "XXXXXX"; 531 they are replaced with a string that makes the file name unique. 532 The file is then created, ensuring it didn't exist before. 533 The file is created read-write (mask at least 0600 & ~umask), but it may be 534 world-readable and world-writable (mask 0666 & ~umask), depending on the 535 implementation. 536 Returns the open file descriptor if successful, otherwise -1 and errno 537 set. */ 538 # if @REPLACE_MKSTEMP@ 539 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 540 # define mkstemp rpl_mkstemp 541 # endif 542 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 543 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); 544 # else 545 # if ! @HAVE_MKSTEMP@ 546 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 547 # endif 548 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); 549 # endif 550 _GL_CXXALIASWARN (mkstemp); 551 #elif defined GNULIB_POSIXCHECK 552 # undef mkstemp 553 # if HAVE_RAW_DECL_MKSTEMP 554 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " 555 "use gnulib module mkstemp for portability"); 556 # endif 557 #endif 558 559 #if @GNULIB_MKSTEMPS@ 560 /* Create a unique temporary file from TEMPLATE. 561 The last six characters of TEMPLATE prior to a suffix of length 562 SUFFIXLEN must be "XXXXXX"; 563 they are replaced with a string that makes the file name unique. 564 The file is then created, ensuring it didn't exist before. 565 The file is created read-write (mask at least 0600 & ~umask), but it may be 566 world-readable and world-writable (mask 0666 & ~umask), depending on the 567 implementation. 568 Returns the open file descriptor if successful, otherwise -1 and errno 569 set. */ 570 # if !@HAVE_MKSTEMPS@ 571 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) 572 _GL_ARG_NONNULL ((1))); 573 # endif 574 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); 575 _GL_CXXALIASWARN (mkstemps); 576 #elif defined GNULIB_POSIXCHECK 577 # undef mkstemps 578 # if HAVE_RAW_DECL_MKSTEMPS 579 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " 580 "use gnulib module mkstemps for portability"); 581 # endif 582 #endif 583 584 #if @GNULIB_MDA_MKTEMP@ 585 /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not 586 required. In C++ with GNULIB_NAMESPACE, avoid differences between 587 platforms by defining GNULIB_NAMESPACE::mktemp always. */ 588 # if defined _WIN32 && !defined __CYGWIN__ 589 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 590 # undef mktemp 591 # define mktemp _mktemp 592 # endif 593 _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/)); 594 # else 595 _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/)); 596 # endif 597 _GL_CXXALIASWARN (mktemp); 598 #endif 599 600 /* Allocate memory with indefinite extent and specified alignment. */ 601 #if @GNULIB_POSIX_MEMALIGN@ 602 # if @REPLACE_POSIX_MEMALIGN@ 603 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 604 # undef posix_memalign 605 # define posix_memalign rpl_posix_memalign 606 # endif 607 _GL_FUNCDECL_RPL (posix_memalign, int, 608 (void **memptr, size_t alignment, size_t size) 609 _GL_ARG_NONNULL ((1))); 610 _GL_CXXALIAS_RPL (posix_memalign, int, 611 (void **memptr, size_t alignment, size_t size)); 612 # else 613 # if @HAVE_POSIX_MEMALIGN@ 614 _GL_CXXALIAS_SYS (posix_memalign, int, 615 (void **memptr, size_t alignment, size_t size)); 616 # endif 617 # endif 618 # if @HAVE_POSIX_MEMALIGN@ 619 _GL_CXXALIASWARN (posix_memalign); 620 # endif 621 #elif defined GNULIB_POSIXCHECK 622 # undef posix_memalign 623 # if HAVE_RAW_DECL_POSIX_MEMALIGN 624 _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " 625 "use gnulib module posix_memalign for portability"); 626 # endif 627 #endif 628 629 #if @GNULIB_POSIX_OPENPT@ 630 /* Return an FD open to the master side of a pseudo-terminal. Flags should 631 include O_RDWR, and may also include O_NOCTTY. */ 632 # if !@HAVE_POSIX_OPENPT@ 633 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); 634 # endif 635 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); 636 _GL_CXXALIASWARN (posix_openpt); 637 #elif defined GNULIB_POSIXCHECK 638 # undef posix_openpt 639 # if HAVE_RAW_DECL_POSIX_OPENPT 640 _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " 641 "use gnulib module posix_openpt for portability"); 642 # endif 643 #endif 644 645 #if @GNULIB_PTSNAME@ 646 /* Return the pathname of the pseudo-terminal slave associated with 647 the master FD is open on, or NULL on errors. */ 648 # if @REPLACE_PTSNAME@ 649 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 650 # undef ptsname 651 # define ptsname rpl_ptsname 652 # endif 653 _GL_FUNCDECL_RPL (ptsname, char *, (int fd)); 654 _GL_CXXALIAS_RPL (ptsname, char *, (int fd)); 655 # else 656 # if !@HAVE_PTSNAME@ 657 _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 658 # endif 659 _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 660 # endif 661 _GL_CXXALIASWARN (ptsname); 662 #elif defined GNULIB_POSIXCHECK 663 # undef ptsname 664 # if HAVE_RAW_DECL_PTSNAME 665 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " 666 "use gnulib module ptsname for portability"); 667 # endif 668 #endif 669 670 #if @GNULIB_PTSNAME_R@ 671 /* Set the pathname of the pseudo-terminal slave associated with 672 the master FD is open on and return 0, or set errno and return 673 non-zero on errors. */ 674 # if @REPLACE_PTSNAME_R@ 675 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 676 # undef ptsname_r 677 # define ptsname_r rpl_ptsname_r 678 # endif 679 _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 680 _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 681 # else 682 # if !@HAVE_PTSNAME_R@ 683 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 684 # endif 685 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 686 # endif 687 # ifndef GNULIB_defined_ptsname_r 688 # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@) 689 # endif 690 _GL_CXXALIASWARN (ptsname_r); 691 #elif defined GNULIB_POSIXCHECK 692 # undef ptsname_r 693 # if HAVE_RAW_DECL_PTSNAME_R 694 _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " 695 "use gnulib module ptsname_r for portability"); 696 # endif 697 #endif 698 699 #if @GNULIB_PUTENV@ 700 # if @REPLACE_PUTENV@ 701 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 702 # undef putenv 703 # define putenv rpl_putenv 704 # endif 705 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 706 _GL_CXXALIAS_RPL (putenv, int, (char *string)); 707 # elif defined _WIN32 && !defined __CYGWIN__ 708 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 709 # undef putenv 710 # define putenv _putenv 711 # endif 712 _GL_CXXALIAS_MDA (putenv, int, (char *string)); 713 # else 714 _GL_CXXALIAS_SYS (putenv, int, (char *string)); 715 # endif 716 _GL_CXXALIASWARN (putenv); 717 #elif @GNULIB_MDA_PUTENV@ 718 /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not 719 required. In C++ with GNULIB_NAMESPACE, avoid differences between 720 platforms by defining GNULIB_NAMESPACE::putenv always. */ 721 # if defined _WIN32 && !defined __CYGWIN__ 722 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 723 # undef putenv 724 # define putenv _putenv 725 # endif 726 /* Need to cast, because on mingw, the parameter is either 727 'const char *string' or 'char *string'. */ 728 _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string)); 729 # else 730 _GL_CXXALIAS_SYS (putenv, int, (char *string)); 731 # endif 732 _GL_CXXALIASWARN (putenv); 733 #endif 734 735 #if @GNULIB_QSORT_R@ 736 /* Sort an array of NMEMB elements, starting at address BASE, each element 737 occupying SIZE bytes, in ascending order according to the comparison 738 function COMPARE. */ 739 # if @REPLACE_QSORT_R@ 740 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 741 # undef qsort_r 742 # define qsort_r rpl_qsort_r 743 # endif 744 _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 745 int (*compare) (void const *, void const *, 746 void *), 747 void *arg) _GL_ARG_NONNULL ((1, 4))); 748 _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 749 int (*compare) (void const *, void const *, 750 void *), 751 void *arg)); 752 # else 753 # if !@HAVE_QSORT_R@ 754 _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 755 int (*compare) (void const *, void const *, 756 void *), 757 void *arg) _GL_ARG_NONNULL ((1, 4))); 758 # endif 759 _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 760 int (*compare) (void const *, void const *, 761 void *), 762 void *arg)); 763 # endif 764 _GL_CXXALIASWARN (qsort_r); 765 #elif defined GNULIB_POSIXCHECK 766 # undef qsort_r 767 # if HAVE_RAW_DECL_QSORT_R 768 _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " 769 "use gnulib module qsort_r for portability"); 770 # endif 771 #endif 772 773 774 #if @GNULIB_RANDOM_R@ 775 # if !@HAVE_RANDOM_R@ 776 # ifndef RAND_MAX 777 # define RAND_MAX 2147483647 778 # endif 779 # endif 780 #endif 781 782 783 #if @GNULIB_RANDOM@ 784 # if @REPLACE_RANDOM@ 785 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 786 # undef random 787 # define random rpl_random 788 # endif 789 _GL_FUNCDECL_RPL (random, long, (void)); 790 _GL_CXXALIAS_RPL (random, long, (void)); 791 # else 792 # if !@HAVE_RANDOM@ 793 _GL_FUNCDECL_SYS (random, long, (void)); 794 # endif 795 /* Need to cast, because on Haiku, the return type is 796 int. */ 797 _GL_CXXALIAS_SYS_CAST (random, long, (void)); 798 # endif 799 _GL_CXXALIASWARN (random); 800 #elif defined GNULIB_POSIXCHECK 801 # undef random 802 # if HAVE_RAW_DECL_RANDOM 803 _GL_WARN_ON_USE (random, "random is unportable - " 804 "use gnulib module random for portability"); 805 # endif 806 #endif 807 808 #if @GNULIB_RANDOM@ 809 # if @REPLACE_RANDOM@ 810 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 811 # undef srandom 812 # define srandom rpl_srandom 813 # endif 814 _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); 815 _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); 816 # else 817 # if !@HAVE_RANDOM@ 818 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 819 # endif 820 /* Need to cast, because on FreeBSD, the first parameter is 821 unsigned long seed. */ 822 _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); 823 # endif 824 _GL_CXXALIASWARN (srandom); 825 #elif defined GNULIB_POSIXCHECK 826 # undef srandom 827 # if HAVE_RAW_DECL_SRANDOM 828 _GL_WARN_ON_USE (srandom, "srandom is unportable - " 829 "use gnulib module random for portability"); 830 # endif 831 #endif 832 833 #if @GNULIB_RANDOM@ 834 # if @REPLACE_INITSTATE@ 835 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 836 # undef initstate 837 # define initstate rpl_initstate 838 # endif 839 _GL_FUNCDECL_RPL (initstate, char *, 840 (unsigned int seed, char *buf, size_t buf_size) 841 _GL_ARG_NONNULL ((2))); 842 _GL_CXXALIAS_RPL (initstate, char *, 843 (unsigned int seed, char *buf, size_t buf_size)); 844 # else 845 # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ 846 _GL_FUNCDECL_SYS (initstate, char *, 847 (unsigned int seed, char *buf, size_t buf_size) 848 _GL_ARG_NONNULL ((2))); 849 # endif 850 /* Need to cast, because on FreeBSD, the first parameter is 851 unsigned long seed. */ 852 _GL_CXXALIAS_SYS_CAST (initstate, char *, 853 (unsigned int seed, char *buf, size_t buf_size)); 854 # endif 855 _GL_CXXALIASWARN (initstate); 856 #elif defined GNULIB_POSIXCHECK 857 # undef initstate 858 # if HAVE_RAW_DECL_INITSTATE 859 _GL_WARN_ON_USE (initstate, "initstate is unportable - " 860 "use gnulib module random for portability"); 861 # endif 862 #endif 863 864 #if @GNULIB_RANDOM@ 865 # if @REPLACE_SETSTATE@ 866 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 867 # undef setstate 868 # define setstate rpl_setstate 869 # endif 870 _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 871 _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); 872 # else 873 # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ 874 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 875 # endif 876 /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter 877 is const char *arg_state. */ 878 _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); 879 # endif 880 _GL_CXXALIASWARN (setstate); 881 #elif defined GNULIB_POSIXCHECK 882 # undef setstate 883 # if HAVE_RAW_DECL_SETSTATE 884 _GL_WARN_ON_USE (setstate, "setstate is unportable - " 885 "use gnulib module random for portability"); 886 # endif 887 #endif 888 889 890 #if @GNULIB_RANDOM_R@ 891 # if @REPLACE_RANDOM_R@ 892 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 893 # undef random_r 894 # define random_r rpl_random_r 895 # endif 896 _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) 897 _GL_ARG_NONNULL ((1, 2))); 898 _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); 899 # else 900 # if !@HAVE_RANDOM_R@ 901 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 902 _GL_ARG_NONNULL ((1, 2))); 903 # endif 904 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 905 # endif 906 _GL_CXXALIASWARN (random_r); 907 #elif defined GNULIB_POSIXCHECK 908 # undef random_r 909 # if HAVE_RAW_DECL_RANDOM_R 910 _GL_WARN_ON_USE (random_r, "random_r is unportable - " 911 "use gnulib module random_r for portability"); 912 # endif 913 #endif 914 915 #if @GNULIB_RANDOM_R@ 916 # if @REPLACE_RANDOM_R@ 917 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 918 # undef srandom_r 919 # define srandom_r rpl_srandom_r 920 # endif 921 _GL_FUNCDECL_RPL (srandom_r, int, 922 (unsigned int seed, struct random_data *rand_state) 923 _GL_ARG_NONNULL ((2))); 924 _GL_CXXALIAS_RPL (srandom_r, int, 925 (unsigned int seed, struct random_data *rand_state)); 926 # else 927 # if !@HAVE_RANDOM_R@ 928 _GL_FUNCDECL_SYS (srandom_r, int, 929 (unsigned int seed, struct random_data *rand_state) 930 _GL_ARG_NONNULL ((2))); 931 # endif 932 _GL_CXXALIAS_SYS (srandom_r, int, 933 (unsigned int seed, struct random_data *rand_state)); 934 # endif 935 _GL_CXXALIASWARN (srandom_r); 936 #elif defined GNULIB_POSIXCHECK 937 # undef srandom_r 938 # if HAVE_RAW_DECL_SRANDOM_R 939 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " 940 "use gnulib module random_r for portability"); 941 # endif 942 #endif 943 944 #if @GNULIB_RANDOM_R@ 945 # if @REPLACE_RANDOM_R@ 946 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 947 # undef initstate_r 948 # define initstate_r rpl_initstate_r 949 # endif 950 _GL_FUNCDECL_RPL (initstate_r, int, 951 (unsigned int seed, char *buf, size_t buf_size, 952 struct random_data *rand_state) 953 _GL_ARG_NONNULL ((2, 4))); 954 _GL_CXXALIAS_RPL (initstate_r, int, 955 (unsigned int seed, char *buf, size_t buf_size, 956 struct random_data *rand_state)); 957 # else 958 # if !@HAVE_RANDOM_R@ 959 _GL_FUNCDECL_SYS (initstate_r, int, 960 (unsigned int seed, char *buf, size_t buf_size, 961 struct random_data *rand_state) 962 _GL_ARG_NONNULL ((2, 4))); 963 # endif 964 /* Need to cast, because on Haiku, the third parameter is 965 unsigned long buf_size. */ 966 _GL_CXXALIAS_SYS_CAST (initstate_r, int, 967 (unsigned int seed, char *buf, size_t buf_size, 968 struct random_data *rand_state)); 969 # endif 970 _GL_CXXALIASWARN (initstate_r); 971 #elif defined GNULIB_POSIXCHECK 972 # undef initstate_r 973 # if HAVE_RAW_DECL_INITSTATE_R 974 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " 975 "use gnulib module random_r for portability"); 976 # endif 977 #endif 978 979 #if @GNULIB_RANDOM_R@ 980 # if @REPLACE_RANDOM_R@ 981 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 982 # undef setstate_r 983 # define setstate_r rpl_setstate_r 984 # endif 985 _GL_FUNCDECL_RPL (setstate_r, int, 986 (char *arg_state, struct random_data *rand_state) 987 _GL_ARG_NONNULL ((1, 2))); 988 _GL_CXXALIAS_RPL (setstate_r, int, 989 (char *arg_state, struct random_data *rand_state)); 990 # else 991 # if !@HAVE_RANDOM_R@ 992 _GL_FUNCDECL_SYS (setstate_r, int, 993 (char *arg_state, struct random_data *rand_state) 994 _GL_ARG_NONNULL ((1, 2))); 995 # endif 996 /* Need to cast, because on Haiku, the first parameter is 997 void *arg_state. */ 998 _GL_CXXALIAS_SYS_CAST (setstate_r, int, 999 (char *arg_state, struct random_data *rand_state)); 1000 # endif 1001 _GL_CXXALIASWARN (setstate_r); 1002 #elif defined GNULIB_POSIXCHECK 1003 # undef setstate_r 1004 # if HAVE_RAW_DECL_SETSTATE_R 1005 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " 1006 "use gnulib module random_r for portability"); 1007 # endif 1008 #endif 1009 1010 1011 #if @GNULIB_REALLOC_POSIX@ 1012 # if @REPLACE_REALLOC@ 1013 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 1014 || _GL_USE_STDLIB_ALLOC) 1015 # undef realloc 1016 # define realloc rpl_realloc 1017 # endif 1018 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); 1019 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 1020 # else 1021 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 1022 # endif 1023 # if __GLIBC__ >= 2 1024 _GL_CXXALIASWARN (realloc); 1025 # endif 1026 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 1027 # undef realloc 1028 /* Assume realloc is always declared. */ 1029 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " 1030 "use gnulib module realloc-posix for portability"); 1031 #endif 1032 1033 1034 #if @GNULIB_REALLOCARRAY@ 1035 # if @REPLACE_REALLOCARRAY@ 1036 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1037 # undef reallocarray 1038 # define reallocarray rpl_reallocarray 1039 # endif 1040 _GL_FUNCDECL_RPL (reallocarray, void *, 1041 (void *ptr, size_t nmemb, size_t size)); 1042 _GL_CXXALIAS_RPL (reallocarray, void *, 1043 (void *ptr, size_t nmemb, size_t size)); 1044 # else 1045 # if ! @HAVE_REALLOCARRAY@ 1046 _GL_FUNCDECL_SYS (reallocarray, void *, 1047 (void *ptr, size_t nmemb, size_t size)); 1048 # endif 1049 _GL_CXXALIAS_SYS (reallocarray, void *, 1050 (void *ptr, size_t nmemb, size_t size)); 1051 # endif 1052 _GL_CXXALIASWARN (reallocarray); 1053 #elif defined GNULIB_POSIXCHECK 1054 # undef reallocarray 1055 # if HAVE_RAW_DECL_REALLOCARRAY 1056 _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " 1057 "use gnulib module reallocarray for portability"); 1058 # endif 1059 #endif 1060 1061 #if @GNULIB_REALPATH@ 1062 # if @REPLACE_REALPATH@ 1063 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1064 # define realpath rpl_realpath 1065 # endif 1066 _GL_FUNCDECL_RPL (realpath, char *, 1067 (const char *restrict name, char *restrict resolved) 1068 _GL_ARG_NONNULL ((1))); 1069 _GL_CXXALIAS_RPL (realpath, char *, 1070 (const char *restrict name, char *restrict resolved)); 1071 # else 1072 # if !@HAVE_REALPATH@ 1073 _GL_FUNCDECL_SYS (realpath, char *, 1074 (const char *restrict name, char *restrict resolved) 1075 _GL_ARG_NONNULL ((1))); 1076 # endif 1077 _GL_CXXALIAS_SYS (realpath, char *, 1078 (const char *restrict name, char *restrict resolved)); 1079 # endif 1080 _GL_CXXALIASWARN (realpath); 1081 #elif defined GNULIB_POSIXCHECK 1082 # undef realpath 1083 # if HAVE_RAW_DECL_REALPATH 1084 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " 1085 "canonicalize or canonicalize-lgpl for portability"); 1086 # endif 1087 #endif 1088 1089 #if @GNULIB_RPMATCH@ 1090 /* Test a user response to a question. 1091 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ 1092 # if !@HAVE_RPMATCH@ 1093 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); 1094 # endif 1095 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); 1096 _GL_CXXALIASWARN (rpmatch); 1097 #elif defined GNULIB_POSIXCHECK 1098 # undef rpmatch 1099 # if HAVE_RAW_DECL_RPMATCH 1100 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " 1101 "use gnulib module rpmatch for portability"); 1102 # endif 1103 #endif 1104 1105 #if @GNULIB_SECURE_GETENV@ 1106 /* Look up NAME in the environment, returning 0 in insecure situations. */ 1107 # if !@HAVE_SECURE_GETENV@ 1108 _GL_FUNCDECL_SYS (secure_getenv, char *, 1109 (char const *name) _GL_ARG_NONNULL ((1))); 1110 # endif 1111 _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); 1112 _GL_CXXALIASWARN (secure_getenv); 1113 #elif defined GNULIB_POSIXCHECK 1114 # undef secure_getenv 1115 # if HAVE_RAW_DECL_SECURE_GETENV 1116 _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " 1117 "use gnulib module secure_getenv for portability"); 1118 # endif 1119 #endif 1120 1121 #if @GNULIB_SETENV@ 1122 /* Set NAME to VALUE in the environment. 1123 If REPLACE is nonzero, overwrite an existing value. */ 1124 # if @REPLACE_SETENV@ 1125 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1126 # undef setenv 1127 # define setenv rpl_setenv 1128 # endif 1129 _GL_FUNCDECL_RPL (setenv, int, 1130 (const char *name, const char *value, int replace) 1131 _GL_ARG_NONNULL ((1))); 1132 _GL_CXXALIAS_RPL (setenv, int, 1133 (const char *name, const char *value, int replace)); 1134 # else 1135 # if !@HAVE_DECL_SETENV@ 1136 _GL_FUNCDECL_SYS (setenv, int, 1137 (const char *name, const char *value, int replace) 1138 _GL_ARG_NONNULL ((1))); 1139 # endif 1140 _GL_CXXALIAS_SYS (setenv, int, 1141 (const char *name, const char *value, int replace)); 1142 # endif 1143 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@) 1144 _GL_CXXALIASWARN (setenv); 1145 # endif 1146 #elif defined GNULIB_POSIXCHECK 1147 # undef setenv 1148 # if HAVE_RAW_DECL_SETENV 1149 _GL_WARN_ON_USE (setenv, "setenv is unportable - " 1150 "use gnulib module setenv for portability"); 1151 # endif 1152 #endif 1153 1154 #if @GNULIB_STRTOD@ 1155 /* Parse a double from STRING, updating ENDP if appropriate. */ 1156 # if @REPLACE_STRTOD@ 1157 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1158 # define strtod rpl_strtod 1159 # endif 1160 # define GNULIB_defined_strtod_function 1 1161 _GL_FUNCDECL_RPL (strtod, double, 1162 (const char *restrict str, char **restrict endp) 1163 _GL_ARG_NONNULL ((1))); 1164 _GL_CXXALIAS_RPL (strtod, double, 1165 (const char *restrict str, char **restrict endp)); 1166 # else 1167 # if !@HAVE_STRTOD@ 1168 _GL_FUNCDECL_SYS (strtod, double, 1169 (const char *restrict str, char **restrict endp) 1170 _GL_ARG_NONNULL ((1))); 1171 # endif 1172 _GL_CXXALIAS_SYS (strtod, double, 1173 (const char *restrict str, char **restrict endp)); 1174 # endif 1175 # if __GLIBC__ >= 2 1176 _GL_CXXALIASWARN (strtod); 1177 # endif 1178 #elif defined GNULIB_POSIXCHECK 1179 # undef strtod 1180 # if HAVE_RAW_DECL_STRTOD 1181 _GL_WARN_ON_USE (strtod, "strtod is unportable - " 1182 "use gnulib module strtod for portability"); 1183 # endif 1184 #endif 1185 1186 #if @GNULIB_STRTOLD@ 1187 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ 1188 # if @REPLACE_STRTOLD@ 1189 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1190 # define strtold rpl_strtold 1191 # endif 1192 # define GNULIB_defined_strtold_function 1 1193 _GL_FUNCDECL_RPL (strtold, long double, 1194 (const char *restrict str, char **restrict endp) 1195 _GL_ARG_NONNULL ((1))); 1196 _GL_CXXALIAS_RPL (strtold, long double, 1197 (const char *restrict str, char **restrict endp)); 1198 # else 1199 # if !@HAVE_STRTOLD@ 1200 _GL_FUNCDECL_SYS (strtold, long double, 1201 (const char *restrict str, char **restrict endp) 1202 _GL_ARG_NONNULL ((1))); 1203 # endif 1204 _GL_CXXALIAS_SYS (strtold, long double, 1205 (const char *restrict str, char **restrict endp)); 1206 # endif 1207 _GL_CXXALIASWARN (strtold); 1208 #elif defined GNULIB_POSIXCHECK 1209 # undef strtold 1210 # if HAVE_RAW_DECL_STRTOLD 1211 _GL_WARN_ON_USE (strtold, "strtold is unportable - " 1212 "use gnulib module strtold for portability"); 1213 # endif 1214 #endif 1215 1216 #if @GNULIB_STRTOL@ 1217 /* Parse a signed integer whose textual representation starts at STRING. 1218 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1219 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 1220 "0x"). 1221 If ENDPTR is not NULL, the address of the first byte after the integer is 1222 stored in *ENDPTR. 1223 Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set 1224 to ERANGE. */ 1225 # if @REPLACE_STRTOL@ 1226 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1227 # define strtol rpl_strtol 1228 # endif 1229 # define GNULIB_defined_strtol_function 1 1230 _GL_FUNCDECL_RPL (strtol, long, 1231 (const char *restrict string, char **restrict endptr, 1232 int base) 1233 _GL_ARG_NONNULL ((1))); 1234 _GL_CXXALIAS_RPL (strtol, long, 1235 (const char *restrict string, char **restrict endptr, 1236 int base)); 1237 # else 1238 # if !@HAVE_STRTOL@ 1239 _GL_FUNCDECL_SYS (strtol, long, 1240 (const char *restrict string, char **restrict endptr, 1241 int base) 1242 _GL_ARG_NONNULL ((1))); 1243 # endif 1244 _GL_CXXALIAS_SYS (strtol, long, 1245 (const char *restrict string, char **restrict endptr, 1246 int base)); 1247 # endif 1248 _GL_CXXALIASWARN (strtol); 1249 #elif defined GNULIB_POSIXCHECK 1250 # undef strtol 1251 # if HAVE_RAW_DECL_STRTOL 1252 _GL_WARN_ON_USE (strtol, "strtol is unportable - " 1253 "use gnulib module strtol for portability"); 1254 # endif 1255 #endif 1256 1257 #if @GNULIB_STRTOLL@ 1258 /* Parse a signed integer whose textual representation starts at STRING. 1259 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1260 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 1261 "0x"). 1262 If ENDPTR is not NULL, the address of the first byte after the integer is 1263 stored in *ENDPTR. 1264 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set 1265 to ERANGE. */ 1266 # if @REPLACE_STRTOLL@ 1267 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1268 # define strtoll rpl_strtoll 1269 # endif 1270 # define GNULIB_defined_strtoll_function 1 1271 _GL_FUNCDECL_RPL (strtoll, long long, 1272 (const char *restrict string, char **restrict endptr, 1273 int base) 1274 _GL_ARG_NONNULL ((1))); 1275 _GL_CXXALIAS_RPL (strtoll, long long, 1276 (const char *restrict string, char **restrict endptr, 1277 int base)); 1278 # else 1279 # if !@HAVE_STRTOLL@ 1280 _GL_FUNCDECL_SYS (strtoll, long long, 1281 (const char *restrict string, char **restrict endptr, 1282 int base) 1283 _GL_ARG_NONNULL ((1))); 1284 # endif 1285 _GL_CXXALIAS_SYS (strtoll, long long, 1286 (const char *restrict string, char **restrict endptr, 1287 int base)); 1288 # endif 1289 _GL_CXXALIASWARN (strtoll); 1290 #elif defined GNULIB_POSIXCHECK 1291 # undef strtoll 1292 # if HAVE_RAW_DECL_STRTOLL 1293 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " 1294 "use gnulib module strtoll for portability"); 1295 # endif 1296 #endif 1297 1298 #if @GNULIB_STRTOUL@ 1299 /* Parse an unsigned integer whose textual representation starts at STRING. 1300 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1301 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 1302 "0x"). 1303 If ENDPTR is not NULL, the address of the first byte after the integer is 1304 stored in *ENDPTR. 1305 Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */ 1306 # if @REPLACE_STRTOUL@ 1307 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1308 # define strtoul rpl_strtoul 1309 # endif 1310 # define GNULIB_defined_strtoul_function 1 1311 _GL_FUNCDECL_RPL (strtoul, unsigned long, 1312 (const char *restrict string, char **restrict endptr, 1313 int base) 1314 _GL_ARG_NONNULL ((1))); 1315 _GL_CXXALIAS_RPL (strtoul, unsigned long, 1316 (const char *restrict string, char **restrict endptr, 1317 int base)); 1318 # else 1319 # if !@HAVE_STRTOUL@ 1320 _GL_FUNCDECL_SYS (strtoul, unsigned long, 1321 (const char *restrict string, char **restrict endptr, 1322 int base) 1323 _GL_ARG_NONNULL ((1))); 1324 # endif 1325 _GL_CXXALIAS_SYS (strtoul, unsigned long, 1326 (const char *restrict string, char **restrict endptr, 1327 int base)); 1328 # endif 1329 _GL_CXXALIASWARN (strtoul); 1330 #elif defined GNULIB_POSIXCHECK 1331 # undef strtoul 1332 # if HAVE_RAW_DECL_STRTOUL 1333 _GL_WARN_ON_USE (strtoul, "strtoul is unportable - " 1334 "use gnulib module strtoul for portability"); 1335 # endif 1336 #endif 1337 1338 #if @GNULIB_STRTOULL@ 1339 /* Parse an unsigned integer whose textual representation starts at STRING. 1340 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1341 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 1342 "0x"). 1343 If ENDPTR is not NULL, the address of the first byte after the integer is 1344 stored in *ENDPTR. 1345 Upon overflow, the return value is ULLONG_MAX, and errno is set to 1346 ERANGE. */ 1347 # if @REPLACE_STRTOULL@ 1348 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1349 # define strtoull rpl_strtoull 1350 # endif 1351 # define GNULIB_defined_strtoull_function 1 1352 _GL_FUNCDECL_RPL (strtoull, unsigned long long, 1353 (const char *restrict string, char **restrict endptr, 1354 int base) 1355 _GL_ARG_NONNULL ((1))); 1356 _GL_CXXALIAS_RPL (strtoull, unsigned long long, 1357 (const char *restrict string, char **restrict endptr, 1358 int base)); 1359 # else 1360 # if !@HAVE_STRTOULL@ 1361 _GL_FUNCDECL_SYS (strtoull, unsigned long long, 1362 (const char *restrict string, char **restrict endptr, 1363 int base) 1364 _GL_ARG_NONNULL ((1))); 1365 # endif 1366 _GL_CXXALIAS_SYS (strtoull, unsigned long long, 1367 (const char *restrict string, char **restrict endptr, 1368 int base)); 1369 # endif 1370 _GL_CXXALIASWARN (strtoull); 1371 #elif defined GNULIB_POSIXCHECK 1372 # undef strtoull 1373 # if HAVE_RAW_DECL_STRTOULL 1374 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - " 1375 "use gnulib module strtoull for portability"); 1376 # endif 1377 #endif 1378 1379 #if @GNULIB_UNLOCKPT@ 1380 /* Unlock the slave side of the pseudo-terminal whose master side is specified 1381 by FD, so that it can be opened. */ 1382 # if !@HAVE_UNLOCKPT@ 1383 _GL_FUNCDECL_SYS (unlockpt, int, (int fd)); 1384 # endif 1385 _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); 1386 _GL_CXXALIASWARN (unlockpt); 1387 #elif defined GNULIB_POSIXCHECK 1388 # undef unlockpt 1389 # if HAVE_RAW_DECL_UNLOCKPT 1390 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " 1391 "use gnulib module unlockpt for portability"); 1392 # endif 1393 #endif 1394 1395 #if @GNULIB_UNSETENV@ 1396 /* Remove the variable NAME from the environment. */ 1397 # if @REPLACE_UNSETENV@ 1398 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1399 # undef unsetenv 1400 # define unsetenv rpl_unsetenv 1401 # endif 1402 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1403 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 1404 # else 1405 # if !@HAVE_DECL_UNSETENV@ 1406 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1407 # endif 1408 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 1409 # endif 1410 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@) 1411 _GL_CXXALIASWARN (unsetenv); 1412 # endif 1413 #elif defined GNULIB_POSIXCHECK 1414 # undef unsetenv 1415 # if HAVE_RAW_DECL_UNSETENV 1416 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " 1417 "use gnulib module unsetenv for portability"); 1418 # endif 1419 #endif 1420 1421 /* Convert a wide character to a multibyte character. */ 1422 #if @GNULIB_WCTOMB@ 1423 # if @REPLACE_WCTOMB@ 1424 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1425 # undef wctomb 1426 # define wctomb rpl_wctomb 1427 # endif 1428 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); 1429 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); 1430 # else 1431 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 1432 # endif 1433 # if __GLIBC__ >= 2 1434 _GL_CXXALIASWARN (wctomb); 1435 # endif 1436 #endif 1437 1438 1439 #endif /* _@GUARD_PREFIX@_STDLIB_H */ 1440 #endif /* _@GUARD_PREFIX@_STDLIB_H */ 1441 #endif 1442