diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-12-28 12:13:40 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-12-28 12:13:40 +0100 |
| commit | b0afb8fe0ff1d87165af9df61501197a06240dda (patch) | |
| tree | 274ac6a96c53ef4c19ab4974ce24a06a233128c5 /gl/stdlib.in.h | |
| parent | 68fc05381ee5fa0aee1413118fbb3d81ca888b09 (diff) | |
| download | monitoring-plugins-b0afb8fe0ff1d87165af9df61501197a06240dda.tar.gz | |
Sync with Gnulib stable-202507 code (a8ac9f9ce5)
Diffstat (limited to 'gl/stdlib.in.h')
| -rw-r--r-- | gl/stdlib.in.h | 497 |
1 files changed, 322 insertions, 175 deletions
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h index e74e7c18..1342db48 100644 --- a/gl/stdlib.in.h +++ b/gl/stdlib.in.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* A GNU-like <stdlib.h>. | 1 | /* A GNU-like <stdlib.h>. |
| 2 | 2 | ||
| 3 | Copyright (C) 1995, 2001-2004, 2006-2024 Free Software Foundation, Inc. | 3 | Copyright (C) 1995, 2001-2004, 2006-2025 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is free software: you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU Lesser General Public License as |
| @@ -20,12 +20,27 @@ | |||
| 20 | #endif | 20 | #endif |
| 21 | @PRAGMA_COLUMNS@ | 21 | @PRAGMA_COLUMNS@ |
| 22 | 22 | ||
| 23 | #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc | 23 | #if ((defined __need_system_stdlib_h && !defined _GLIBCXX_STDLIB_H) \ |
| 24 | || defined __need_malloc_and_calloc) \ | ||
| 25 | && !defined __SUNPRO_CC | ||
| 24 | /* Special invocation conventions inside some gnulib header files, | 26 | /* Special invocation conventions inside some gnulib header files, |
| 25 | and inside some glibc header files, respectively. */ | 27 | and inside some glibc header files, respectively. |
| 28 | Do not recognize this special invocation convention when GCC's | ||
| 29 | c++/11/stdlib.h is being included or has been included. This is needed | ||
| 30 | to support the use of clang+llvm binaries on Ubuntu 22.04 with | ||
| 31 | CXX="$clangdir/bin/clang++ -I/usr/include/c++/11 \ | ||
| 32 | -I/usr/include/x86_64-linux-gnu/c++/11 | ||
| 33 | -L/usr/lib/gcc/x86_64-linux-gnu/11 | ||
| 34 | -Wl,-rpath,$clangdir/lib" | ||
| 35 | because in this case /usr/include/c++/11/stdlib.h (which does not support | ||
| 36 | the convention) is seen before the gnulib-generated stdlib.h. */ | ||
| 26 | 37 | ||
| 27 | #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ | 38 | #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ |
| 28 | 39 | ||
| 40 | /* Make sure that the macros that indicate the special invocation convention | ||
| 41 | get undefined. This is needed at least on CentOS 7. */ | ||
| 42 | #undef __need_malloc_and_calloc | ||
| 43 | |||
| 29 | #else | 44 | #else |
| 30 | /* Normal invocation convention. */ | 45 | /* Normal invocation convention. */ |
| 31 | 46 | ||
| @@ -38,8 +53,8 @@ | |||
| 38 | #define _@GUARD_PREFIX@_STDLIB_H | 53 | #define _@GUARD_PREFIX@_STDLIB_H |
| 39 | 54 | ||
| 40 | /* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, | 55 | /* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, |
| 41 | _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, | 56 | _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, |
| 42 | HAVE_RAW_DECL_*. */ | 57 | _GL_INLINE_HEADER_BEGIN, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ |
| 43 | #if !_GL_CONFIG_H_INCLUDED | 58 | #if !_GL_CONFIG_H_INCLUDED |
| 44 | #error "Please include config.h first." | 59 | #error "Please include config.h first." |
| 45 | #endif | 60 | #endif |
| @@ -47,8 +62,9 @@ | |||
| 47 | /* NetBSD 5.0 mis-defines NULL. */ | 62 | /* NetBSD 5.0 mis-defines NULL. */ |
| 48 | #include <stddef.h> | 63 | #include <stddef.h> |
| 49 | 64 | ||
| 50 | /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */ | 65 | /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. |
| 51 | #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS | 66 | glibc 2.41 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */ |
| 67 | #if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP) | ||
| 52 | # include <sys/wait.h> | 68 | # include <sys/wait.h> |
| 53 | #endif | 69 | #endif |
| 54 | 70 | ||
| @@ -104,11 +120,30 @@ struct random_data | |||
| 104 | # include <unistd.h> | 120 | # include <unistd.h> |
| 105 | #endif | 121 | #endif |
| 106 | 122 | ||
| 123 | #if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && (defined __sun || defined _AIX) | ||
| 124 | /* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro | ||
| 125 | below, this may cause compilation errors later in the libstdc++ header files | ||
| 126 | (that are part of GCC), such as: | ||
| 127 | error: 'rpl_strtol' is not a member of 'std' | ||
| 128 | To avoid this, include the relevant header files here, before these symbols | ||
| 129 | get defined as macros. But do so only on Solaris 11 and AIX (where it is | ||
| 130 | needed), not on mingw (where it would cause other compilation errors). */ | ||
| 131 | # include <string> | ||
| 132 | #endif | ||
| 133 | |||
| 134 | _GL_INLINE_HEADER_BEGIN | ||
| 135 | #ifndef _GL_STDLIB_INLINE | ||
| 136 | # define _GL_STDLIB_INLINE _GL_INLINE | ||
| 137 | #endif | ||
| 138 | #ifndef _GL_REALLOC_INLINE | ||
| 139 | # define _GL_REALLOC_INLINE _GL_INLINE | ||
| 140 | #endif | ||
| 141 | |||
| 107 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers | 142 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers |
| 108 | that can be freed by passing them as the Ith argument to the | 143 | that can be freed by passing them as the Ith argument to the |
| 109 | function F. */ | 144 | function F. */ |
| 110 | #ifndef _GL_ATTRIBUTE_DEALLOC | 145 | #ifndef _GL_ATTRIBUTE_DEALLOC |
| 111 | # if __GNUC__ >= 11 | 146 | # if __GNUC__ >= 11 && !defined __clang__ |
| 112 | # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) | 147 | # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) |
| 113 | # else | 148 | # else |
| 114 | # define _GL_ATTRIBUTE_DEALLOC(f, i) | 149 | # define _GL_ATTRIBUTE_DEALLOC(f, i) |
| @@ -133,11 +168,23 @@ struct random_data | |||
| 133 | # endif | 168 | # endif |
| 134 | #endif | 169 | #endif |
| 135 | 170 | ||
| 171 | /* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP | ||
| 172 | (a pointer) must not be NULL if the argument NI (an integer) is != 0. */ | ||
| 173 | /* Applies to: functions. */ | ||
| 174 | #ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO | ||
| 175 | # if __GNUC__ >= 15 && !defined __clang__ | ||
| 176 | # define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \ | ||
| 177 | __attribute__ ((__nonnull_if_nonzero__ (np, ni))) | ||
| 178 | # else | ||
| 179 | # define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) | ||
| 180 | # endif | ||
| 181 | #endif | ||
| 182 | |||
| 136 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | 183 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. |
| 137 | */ | 184 | */ |
| 138 | #ifndef _GL_ATTRIBUTE_NOTHROW | 185 | #ifndef _GL_ATTRIBUTE_NOTHROW |
| 139 | # if defined __cplusplus | 186 | # if defined __cplusplus |
| 140 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 | 187 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4 |
| 141 | # if __cplusplus >= 201103L | 188 | # if __cplusplus >= 201103L |
| 142 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | 189 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) |
| 143 | # else | 190 | # else |
| @@ -188,6 +235,18 @@ struct random_data | |||
| 188 | #endif | 235 | #endif |
| 189 | 236 | ||
| 190 | 237 | ||
| 238 | /* Declarations for ISO C N3322. */ | ||
| 239 | #if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ | ||
| 240 | _GL_EXTERN_C void *bsearch (const void *__key, | ||
| 241 | const void *__base, size_t __nmemb, size_t __size, | ||
| 242 | int (*__compare) (const void *, const void *)) | ||
| 243 | _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5)); | ||
| 244 | _GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size, | ||
| 245 | int (*__compare) (const void *, const void *)) | ||
| 246 | _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ARG_NONNULL ((4)); | ||
| 247 | #endif | ||
| 248 | |||
| 249 | |||
| 191 | #if @GNULIB__EXIT@ | 250 | #if @GNULIB__EXIT@ |
| 192 | /* Terminate the current process with the given return code, without running | 251 | /* Terminate the current process with the given return code, without running |
| 193 | the 'atexit' handlers. */ | 252 | the 'atexit' handlers. */ |
| @@ -196,11 +255,11 @@ struct random_data | |||
| 196 | # undef _Exit | 255 | # undef _Exit |
| 197 | # define _Exit rpl__Exit | 256 | # define _Exit rpl__Exit |
| 198 | # endif | 257 | # endif |
| 199 | _GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status)); | 258 | _GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status), ); |
| 200 | _GL_CXXALIAS_RPL (_Exit, void, (int status)); | 259 | _GL_CXXALIAS_RPL (_Exit, void, (int status)); |
| 201 | # else | 260 | # else |
| 202 | # if !@HAVE__EXIT@ | 261 | # if !@HAVE__EXIT@ |
| 203 | _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); | 262 | _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status), ); |
| 204 | # endif | 263 | # endif |
| 205 | _GL_CXXALIAS_SYS (_Exit, void, (int status)); | 264 | _GL_CXXALIAS_SYS (_Exit, void, (int status)); |
| 206 | # endif | 265 | # endif |
| @@ -216,6 +275,26 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " | |||
| 216 | #endif | 275 | #endif |
| 217 | 276 | ||
| 218 | 277 | ||
| 278 | #if @GNULIB_ABORT_DEBUG@ | ||
| 279 | /* Terminates the current process with signal SIGABRT. | ||
| 280 | Note: While the original abort() function is safe to call in signal handlers, | ||
| 281 | the overridden abort() function is not. */ | ||
| 282 | # if @REPLACE_ABORT@ | ||
| 283 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 284 | # undef abort | ||
| 285 | # define abort rpl_abort | ||
| 286 | # endif | ||
| 287 | _GL_FUNCDECL_RPL (abort, _Noreturn void, (void), ); | ||
| 288 | _GL_CXXALIAS_RPL (abort, void, (void)); | ||
| 289 | # else | ||
| 290 | _GL_CXXALIAS_SYS (abort, void, (void)); | ||
| 291 | # endif | ||
| 292 | # if __GLIBC__ >= 2 | ||
| 293 | _GL_CXXALIASWARN (abort); | ||
| 294 | # endif | ||
| 295 | #endif | ||
| 296 | |||
| 297 | |||
| 219 | #if @GNULIB_FREE_POSIX@ | 298 | #if @GNULIB_FREE_POSIX@ |
| 220 | # if @REPLACE_FREE@ | 299 | # if @REPLACE_FREE@ |
| 221 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 300 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| @@ -223,9 +302,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " | |||
| 223 | # define free rpl_free | 302 | # define free rpl_free |
| 224 | # endif | 303 | # endif |
| 225 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | 304 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) |
| 226 | _GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW); | 305 | _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW; |
| 227 | # else | 306 | # else |
| 228 | _GL_FUNCDECL_RPL (free, void, (void *ptr)); | 307 | _GL_FUNCDECL_RPL (free, void, (void *ptr), ); |
| 229 | # endif | 308 | # endif |
| 230 | _GL_CXXALIAS_RPL (free, void, (void *ptr)); | 309 | _GL_CXXALIAS_RPL (free, void, (void *ptr)); |
| 231 | # else | 310 | # else |
| @@ -237,8 +316,8 @@ _GL_CXXALIASWARN (free); | |||
| 237 | #elif defined GNULIB_POSIXCHECK | 316 | #elif defined GNULIB_POSIXCHECK |
| 238 | # undef free | 317 | # undef free |
| 239 | /* Assume free is always declared. */ | 318 | /* Assume free is always declared. */ |
| 240 | _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " | 319 | _GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - " |
| 241 | "use gnulib module free for portability"); | 320 | "use gnulib module free-posix for portability"); |
| 242 | #endif | 321 | #endif |
| 243 | 322 | ||
| 244 | 323 | ||
| @@ -250,22 +329,25 @@ _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " | |||
| 250 | # define aligned_alloc rpl_aligned_alloc | 329 | # define aligned_alloc rpl_aligned_alloc |
| 251 | # endif | 330 | # endif |
| 252 | _GL_FUNCDECL_RPL (aligned_alloc, void *, | 331 | _GL_FUNCDECL_RPL (aligned_alloc, void *, |
| 253 | (size_t alignment, size_t size) | 332 | (size_t alignment, size_t size), |
| 254 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 333 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 334 | _GL_ATTRIBUTE_NODISCARD); | ||
| 255 | _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); | 335 | _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); |
| 256 | # else | 336 | # else |
| 257 | # if @HAVE_ALIGNED_ALLOC@ | 337 | # if @HAVE_ALIGNED_ALLOC@ |
| 258 | # if __GNUC__ >= 11 | 338 | # if __GNUC__ >= 11 && !defined __clang__ |
| 259 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ | 339 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ |
| 260 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 | 340 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 |
| 261 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | 341 | _GL_FUNCDECL_SYS (aligned_alloc, void *, |
| 262 | (size_t alignment, size_t size) | 342 | (size_t alignment, size_t size), |
| 263 | _GL_ATTRIBUTE_NOTHROW | 343 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 264 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 344 | _GL_ATTRIBUTE_NODISCARD) |
| 345 | _GL_ATTRIBUTE_NOTHROW; | ||
| 265 | # else | 346 | # else |
| 266 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | 347 | _GL_FUNCDECL_SYS (aligned_alloc, void *, |
| 267 | (size_t alignment, size_t size) | 348 | (size_t alignment, size_t size), |
| 268 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 349 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 350 | _GL_ATTRIBUTE_NODISCARD); | ||
| 269 | # endif | 351 | # endif |
| 270 | # endif | 352 | # endif |
| 271 | _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); | 353 | _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); |
| @@ -275,16 +357,17 @@ _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); | |||
| 275 | _GL_CXXALIASWARN (aligned_alloc); | 357 | _GL_CXXALIASWARN (aligned_alloc); |
| 276 | # endif | 358 | # endif |
| 277 | #else | 359 | #else |
| 278 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc | 360 | # if @GNULIB_FREE_POSIX@ \ |
| 361 | && (__GNUC__ >= 11 && !defined __clang__) && !defined aligned_alloc | ||
| 279 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ | 362 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ |
| 280 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 | 363 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 |
| 281 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | 364 | _GL_FUNCDECL_SYS (aligned_alloc, void *, |
| 282 | (size_t alignment, size_t size) | 365 | (size_t alignment, size_t size), |
| 283 | _GL_ATTRIBUTE_NOTHROW | 366 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) |
| 284 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 367 | _GL_ATTRIBUTE_NOTHROW; |
| 285 | # else | 368 | # else |
| 286 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | 369 | _GL_FUNCDECL_SYS (aligned_alloc, void *, |
| 287 | (size_t alignment, size_t size) | 370 | (size_t alignment, size_t size), |
| 288 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 371 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
| 289 | # endif | 372 | # endif |
| 290 | # endif | 373 | # endif |
| @@ -301,9 +384,10 @@ _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " | |||
| 301 | /* Parse a signed decimal integer. | 384 | /* Parse a signed decimal integer. |
| 302 | Returns the value of the integer. Errors are not detected. */ | 385 | Returns the value of the integer. Errors are not detected. */ |
| 303 | # if !@HAVE_ATOLL@ | 386 | # if !@HAVE_ATOLL@ |
| 304 | _GL_FUNCDECL_SYS (atoll, long long, (const char *string) | 387 | _GL_FUNCDECL_SYS (atoll, long long, |
| 305 | _GL_ATTRIBUTE_PURE | 388 | (const char *string), |
| 306 | _GL_ARG_NONNULL ((1))); | 389 | _GL_ATTRIBUTE_PURE |
| 390 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); | ||
| 307 | # endif | 391 | # endif |
| 308 | _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); | 392 | _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); |
| 309 | _GL_CXXALIASWARN (atoll); | 393 | _GL_CXXALIASWARN (atoll); |
| @@ -316,28 +400,32 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - " | |||
| 316 | #endif | 400 | #endif |
| 317 | 401 | ||
| 318 | #if @GNULIB_CALLOC_POSIX@ | 402 | #if @GNULIB_CALLOC_POSIX@ |
| 319 | # if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \ | 403 | # if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \ |
| 320 | || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) | 404 | || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) |
| 321 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 405 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ |
| 406 | || _GL_USE_STDLIB_ALLOC) | ||
| 322 | # undef calloc | 407 | # undef calloc |
| 323 | # define calloc rpl_calloc | 408 | # define calloc rpl_calloc |
| 324 | # endif | 409 | # endif |
| 325 | _GL_FUNCDECL_RPL (calloc, void *, | 410 | _GL_FUNCDECL_RPL (calloc, void *, |
| 326 | (size_t nmemb, size_t size) | 411 | (size_t nmemb, size_t size), |
| 327 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 412 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 413 | _GL_ATTRIBUTE_NODISCARD); | ||
| 328 | _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); | 414 | _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); |
| 329 | # else | 415 | # else |
| 330 | # if __GNUC__ >= 11 | 416 | # if __GNUC__ >= 11 && !defined __clang__ |
| 331 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ | 417 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ |
| 332 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | 418 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 |
| 333 | _GL_FUNCDECL_SYS (calloc, void *, | 419 | _GL_FUNCDECL_SYS (calloc, void *, |
| 334 | (size_t nmemb, size_t size) | 420 | (size_t nmemb, size_t size), |
| 335 | _GL_ATTRIBUTE_NOTHROW | 421 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 336 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 422 | _GL_ATTRIBUTE_NODISCARD) |
| 423 | _GL_ATTRIBUTE_NOTHROW; | ||
| 337 | # else | 424 | # else |
| 338 | _GL_FUNCDECL_SYS (calloc, void *, | 425 | _GL_FUNCDECL_SYS (calloc, void *, |
| 339 | (size_t nmemb, size_t size) | 426 | (size_t nmemb, size_t size), |
| 340 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 427 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 428 | _GL_ATTRIBUTE_NODISCARD); | ||
| 341 | # endif | 429 | # endif |
| 342 | # endif | 430 | # endif |
| 343 | _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); | 431 | _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); |
| @@ -346,16 +434,17 @@ _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); | |||
| 346 | _GL_CXXALIASWARN (calloc); | 434 | _GL_CXXALIASWARN (calloc); |
| 347 | # endif | 435 | # endif |
| 348 | #else | 436 | #else |
| 349 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc | 437 | # if @GNULIB_FREE_POSIX@ \ |
| 438 | && (__GNUC__ >= 11 && !defined __clang__) && !defined calloc | ||
| 350 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ | 439 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ |
| 351 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | 440 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 |
| 352 | _GL_FUNCDECL_SYS (calloc, void *, | 441 | _GL_FUNCDECL_SYS (calloc, void *, |
| 353 | (size_t nmemb, size_t size) | 442 | (size_t nmemb, size_t size), |
| 354 | _GL_ATTRIBUTE_NOTHROW | 443 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) |
| 355 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 444 | _GL_ATTRIBUTE_NOTHROW; |
| 356 | # else | 445 | # else |
| 357 | _GL_FUNCDECL_SYS (calloc, void *, | 446 | _GL_FUNCDECL_SYS (calloc, void *, |
| 358 | (size_t nmemb, size_t size) | 447 | (size_t nmemb, size_t size), |
| 359 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 448 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
| 360 | # endif | 449 | # endif |
| 361 | # endif | 450 | # endif |
| @@ -373,23 +462,26 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " | |||
| 373 | # define canonicalize_file_name rpl_canonicalize_file_name | 462 | # define canonicalize_file_name rpl_canonicalize_file_name |
| 374 | # endif | 463 | # endif |
| 375 | _GL_FUNCDECL_RPL (canonicalize_file_name, char *, | 464 | _GL_FUNCDECL_RPL (canonicalize_file_name, char *, |
| 376 | (const char *name) | 465 | (const char *name), |
| 377 | _GL_ARG_NONNULL ((1)) | 466 | _GL_ARG_NONNULL ((1)) |
| 378 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 467 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 468 | _GL_ATTRIBUTE_NODISCARD); | ||
| 379 | _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); | 469 | _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); |
| 380 | # else | 470 | # else |
| 381 | # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 | 471 | # if !@HAVE_CANONICALIZE_FILE_NAME@ || (__GNUC__ >= 11 && !defined __clang__) |
| 382 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | 472 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 |
| 383 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, | 473 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, |
| 384 | (const char *name) | 474 | (const char *name), |
| 385 | _GL_ATTRIBUTE_NOTHROW | ||
| 386 | _GL_ARG_NONNULL ((1)) | 475 | _GL_ARG_NONNULL ((1)) |
| 387 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 476 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 477 | _GL_ATTRIBUTE_NODISCARD) | ||
| 478 | _GL_ATTRIBUTE_NOTHROW; | ||
| 388 | # else | 479 | # else |
| 389 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, | 480 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, |
| 390 | (const char *name) | 481 | (const char *name), |
| 391 | _GL_ARG_NONNULL ((1)) | 482 | _GL_ARG_NONNULL ((1)) |
| 392 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 483 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 484 | _GL_ATTRIBUTE_NODISCARD); | ||
| 393 | # endif | 485 | # endif |
| 394 | # endif | 486 | # endif |
| 395 | _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); | 487 | _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); |
| @@ -400,18 +492,19 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); | |||
| 400 | # endif | 492 | # endif |
| 401 | _GL_CXXALIASWARN (canonicalize_file_name); | 493 | _GL_CXXALIASWARN (canonicalize_file_name); |
| 402 | #else | 494 | #else |
| 403 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name | 495 | # if @GNULIB_FREE_POSIX@ \ |
| 496 | && (__GNUC__ >= 11 && !defined __clang__) && !defined canonicalize_file_name | ||
| 404 | /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or | 497 | /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or |
| 405 | rpl_free. */ | 498 | rpl_free. */ |
| 406 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | 499 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 |
| 407 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, | 500 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, |
| 408 | (const char *name) | 501 | (const char *name), |
| 409 | _GL_ATTRIBUTE_NOTHROW | ||
| 410 | _GL_ARG_NONNULL ((1)) | 502 | _GL_ARG_NONNULL ((1)) |
| 411 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 503 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) |
| 504 | _GL_ATTRIBUTE_NOTHROW; | ||
| 412 | # else | 505 | # else |
| 413 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, | 506 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, |
| 414 | (const char *name) | 507 | (const char *name), |
| 415 | _GL_ARG_NONNULL ((1)) | 508 | _GL_ARG_NONNULL ((1)) |
| 416 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 509 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
| 417 | # endif | 510 | # endif |
| @@ -503,12 +596,12 @@ _GL_CXXALIASWARN (gcvt); | |||
| 503 | # undef getloadavg | 596 | # undef getloadavg |
| 504 | # define getloadavg rpl_getloadavg | 597 | # define getloadavg rpl_getloadavg |
| 505 | # endif | 598 | # endif |
| 506 | _GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem) | 599 | _GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem), |
| 507 | _GL_ARG_NONNULL ((1))); | 600 | _GL_ARG_NONNULL ((1))); |
| 508 | _GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem)); | 601 | _GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem)); |
| 509 | # else | 602 | # else |
| 510 | # if !@HAVE_DECL_GETLOADAVG@ | 603 | # if !@HAVE_DECL_GETLOADAVG@ |
| 511 | _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) | 604 | _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem), |
| 512 | _GL_ARG_NONNULL ((1))); | 605 | _GL_ARG_NONNULL ((1))); |
| 513 | # endif | 606 | # endif |
| 514 | _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); | 607 | _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); |
| @@ -533,17 +626,17 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " | |||
| 533 | # define getprogname rpl_getprogname | 626 | # define getprogname rpl_getprogname |
| 534 | # endif | 627 | # endif |
| 535 | # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ | 628 | # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ |
| 536 | _GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); | 629 | _GL_FUNCDECL_RPL (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE); |
| 537 | # else | 630 | # else |
| 538 | _GL_FUNCDECL_RPL (getprogname, const char *, (void)); | 631 | _GL_FUNCDECL_RPL (getprogname, const char *, (void), ); |
| 539 | # endif | 632 | # endif |
| 540 | _GL_CXXALIAS_RPL (getprogname, const char *, (void)); | 633 | _GL_CXXALIAS_RPL (getprogname, const char *, (void)); |
| 541 | # else | 634 | # else |
| 542 | # if !@HAVE_GETPROGNAME@ | 635 | # if !@HAVE_GETPROGNAME@ |
| 543 | # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ | 636 | # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ |
| 544 | _GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); | 637 | _GL_FUNCDECL_SYS (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE); |
| 545 | # else | 638 | # else |
| 546 | _GL_FUNCDECL_SYS (getprogname, const char *, (void)); | 639 | _GL_FUNCDECL_SYS (getprogname, const char *, (void), ); |
| 547 | # endif | 640 | # endif |
| 548 | # endif | 641 | # endif |
| 549 | _GL_CXXALIAS_SYS (getprogname, const char *, (void)); | 642 | _GL_CXXALIAS_SYS (getprogname, const char *, (void)); |
| @@ -577,15 +670,15 @@ _GL_WARN_ON_USE (getprogname, "getprogname is unportable - " | |||
| 577 | # define getsubopt rpl_getsubopt | 670 | # define getsubopt rpl_getsubopt |
| 578 | # endif | 671 | # endif |
| 579 | _GL_FUNCDECL_RPL (getsubopt, int, | 672 | _GL_FUNCDECL_RPL (getsubopt, int, |
| 580 | (char **optionp, char *const *tokens, char **valuep) | 673 | (char **optionp, char *const *tokens, char **valuep), |
| 581 | _GL_ARG_NONNULL ((1, 2, 3))); | 674 | _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD); |
| 582 | _GL_CXXALIAS_RPL (getsubopt, int, | 675 | _GL_CXXALIAS_RPL (getsubopt, int, |
| 583 | (char **optionp, char *const *tokens, char **valuep)); | 676 | (char **optionp, char *const *tokens, char **valuep)); |
| 584 | # else | 677 | # else |
| 585 | # if !@HAVE_GETSUBOPT@ | 678 | # if !@HAVE_GETSUBOPT@ |
| 586 | _GL_FUNCDECL_SYS (getsubopt, int, | 679 | _GL_FUNCDECL_SYS (getsubopt, int, |
| 587 | (char **optionp, char *const *tokens, char **valuep) | 680 | (char **optionp, char *const *tokens, char **valuep), |
| 588 | _GL_ARG_NONNULL ((1, 2, 3))); | 681 | _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD); |
| 589 | # endif | 682 | # endif |
| 590 | _GL_CXXALIAS_SYS (getsubopt, int, | 683 | _GL_CXXALIAS_SYS (getsubopt, int, |
| 591 | (char **optionp, char *const *tokens, char **valuep)); | 684 | (char **optionp, char *const *tokens, char **valuep)); |
| @@ -605,7 +698,7 @@ _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " | |||
| 605 | /* Change the ownership and access permission of the slave side of the | 698 | /* Change the ownership and access permission of the slave side of the |
| 606 | pseudo-terminal whose master side is specified by FD. */ | 699 | pseudo-terminal whose master side is specified by FD. */ |
| 607 | # if !@HAVE_GRANTPT@ | 700 | # if !@HAVE_GRANTPT@ |
| 608 | _GL_FUNCDECL_SYS (grantpt, int, (int fd)); | 701 | _GL_FUNCDECL_SYS (grantpt, int, (int fd), ); |
| 609 | # endif | 702 | # endif |
| 610 | _GL_CXXALIAS_SYS (grantpt, int, (int fd)); | 703 | _GL_CXXALIAS_SYS (grantpt, int, (int fd)); |
| 611 | _GL_CXXALIASWARN (grantpt); | 704 | _GL_CXXALIASWARN (grantpt); |
| @@ -622,7 +715,7 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " | |||
| 622 | by never specifying a zero size), so it does not need malloc or | 715 | by never specifying a zero size), so it does not need malloc or |
| 623 | realloc to be redefined. */ | 716 | realloc to be redefined. */ |
| 624 | #if @GNULIB_MALLOC_POSIX@ | 717 | #if @GNULIB_MALLOC_POSIX@ |
| 625 | # if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \ | 718 | # if @REPLACE_MALLOC_FOR_MALLOC_POSIX@ \ |
| 626 | || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) | 719 | || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) |
| 627 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ | 720 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ |
| 628 | || _GL_USE_STDLIB_ALLOC) | 721 | || _GL_USE_STDLIB_ALLOC) |
| @@ -630,21 +723,24 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " | |||
| 630 | # define malloc rpl_malloc | 723 | # define malloc rpl_malloc |
| 631 | # endif | 724 | # endif |
| 632 | _GL_FUNCDECL_RPL (malloc, void *, | 725 | _GL_FUNCDECL_RPL (malloc, void *, |
| 633 | (size_t size) | 726 | (size_t size), |
| 634 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 727 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 728 | _GL_ATTRIBUTE_NODISCARD); | ||
| 635 | _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); | 729 | _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); |
| 636 | # else | 730 | # else |
| 637 | # if __GNUC__ >= 11 | 731 | # if __GNUC__ >= 11 && !defined __clang__ |
| 638 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ | 732 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ |
| 639 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | 733 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 |
| 640 | _GL_FUNCDECL_SYS (malloc, void *, | 734 | _GL_FUNCDECL_SYS (malloc, void *, |
| 641 | (size_t size) | 735 | (size_t size), |
| 642 | _GL_ATTRIBUTE_NOTHROW | 736 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 643 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 737 | _GL_ATTRIBUTE_NODISCARD) |
| 738 | _GL_ATTRIBUTE_NOTHROW; | ||
| 644 | # else | 739 | # else |
| 645 | _GL_FUNCDECL_SYS (malloc, void *, | 740 | _GL_FUNCDECL_SYS (malloc, void *, |
| 646 | (size_t size) | 741 | (size_t size), |
| 647 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 742 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE |
| 743 | _GL_ATTRIBUTE_NODISCARD); | ||
| 648 | # endif | 744 | # endif |
| 649 | # endif | 745 | # endif |
| 650 | _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); | 746 | _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); |
| @@ -653,16 +749,17 @@ _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); | |||
| 653 | _GL_CXXALIASWARN (malloc); | 749 | _GL_CXXALIASWARN (malloc); |
| 654 | # endif | 750 | # endif |
| 655 | #else | 751 | #else |
| 656 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc | 752 | # if @GNULIB_FREE_POSIX@ \ |
| 753 | && (__GNUC__ >= 11 && !defined __clang__) && !defined malloc | ||
| 657 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ | 754 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ |
| 658 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | 755 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 |
| 659 | _GL_FUNCDECL_SYS (malloc, void *, | 756 | _GL_FUNCDECL_SYS (malloc, void *, |
| 660 | (size_t size) | 757 | (size_t size), |
| 661 | _GL_ATTRIBUTE_NOTHROW | 758 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) |
| 662 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 759 | _GL_ATTRIBUTE_NOTHROW; |
| 663 | # else | 760 | # else |
| 664 | _GL_FUNCDECL_SYS (malloc, void *, | 761 | _GL_FUNCDECL_SYS (malloc, void *, |
| 665 | (size_t size) | 762 | (size_t size), |
| 666 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 763 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
| 667 | # endif | 764 | # endif |
| 668 | # endif | 765 | # endif |
| @@ -674,14 +771,20 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " | |||
| 674 | # endif | 771 | # endif |
| 675 | #endif | 772 | #endif |
| 676 | 773 | ||
| 677 | /* Return maximum number of bytes of a multibyte character. */ | 774 | /* Return maximum number of bytes in a multibyte character in the |
| 775 | current locale. */ | ||
| 678 | #if @REPLACE_MB_CUR_MAX@ | 776 | #if @REPLACE_MB_CUR_MAX@ |
| 679 | # if !GNULIB_defined_MB_CUR_MAX | 777 | # if !GNULIB_defined_MB_CUR_MAX |
| 680 | static inline | 778 | _GL_STDLIB_INLINE size_t |
| 681 | int gl_MB_CUR_MAX (void) | 779 | gl_MB_CUR_MAX (void) |
| 682 | { | 780 | { |
| 781 | # if 0 < @REPLACE_MB_CUR_MAX@ | ||
| 782 | return @REPLACE_MB_CUR_MAX@; | ||
| 783 | # else | ||
| 683 | /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ | 784 | /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ |
| 684 | return MB_CUR_MAX + (MB_CUR_MAX == 3); | 785 | int gl_mb_cur_max = MB_CUR_MAX; |
| 786 | return gl_mb_cur_max == 3 ? 4 : gl_mb_cur_max; | ||
| 787 | # endif | ||
| 685 | } | 788 | } |
| 686 | # undef MB_CUR_MAX | 789 | # undef MB_CUR_MAX |
| 687 | # define MB_CUR_MAX gl_MB_CUR_MAX () | 790 | # define MB_CUR_MAX gl_MB_CUR_MAX () |
| @@ -698,7 +801,7 @@ int gl_MB_CUR_MAX (void) | |||
| 698 | # endif | 801 | # endif |
| 699 | _GL_FUNCDECL_RPL (mbstowcs, size_t, | 802 | _GL_FUNCDECL_RPL (mbstowcs, size_t, |
| 700 | (wchar_t *restrict dest, const char *restrict src, | 803 | (wchar_t *restrict dest, const char *restrict src, |
| 701 | size_t len) | 804 | size_t len), |
| 702 | _GL_ARG_NONNULL ((2))); | 805 | _GL_ARG_NONNULL ((2))); |
| 703 | _GL_CXXALIAS_RPL (mbstowcs, size_t, | 806 | _GL_CXXALIAS_RPL (mbstowcs, size_t, |
| 704 | (wchar_t *restrict dest, const char *restrict src, | 807 | (wchar_t *restrict dest, const char *restrict src, |
| @@ -727,13 +830,13 @@ _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - " | |||
| 727 | # define mbtowc rpl_mbtowc | 830 | # define mbtowc rpl_mbtowc |
| 728 | # endif | 831 | # endif |
| 729 | _GL_FUNCDECL_RPL (mbtowc, int, | 832 | _GL_FUNCDECL_RPL (mbtowc, int, |
| 730 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); | 833 | (wchar_t *restrict pwc, const char *restrict s, size_t n), ); |
| 731 | _GL_CXXALIAS_RPL (mbtowc, int, | 834 | _GL_CXXALIAS_RPL (mbtowc, int, |
| 732 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); | 835 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); |
| 733 | # else | 836 | # else |
| 734 | # if !@HAVE_MBTOWC@ | 837 | # if !@HAVE_MBTOWC@ |
| 735 | _GL_FUNCDECL_SYS (mbtowc, int, | 838 | _GL_FUNCDECL_SYS (mbtowc, int, |
| 736 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); | 839 | (wchar_t *restrict pwc, const char *restrict s, size_t n), ); |
| 737 | # endif | 840 | # endif |
| 738 | _GL_CXXALIAS_SYS (mbtowc, int, | 841 | _GL_CXXALIAS_SYS (mbtowc, int, |
| 739 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); | 842 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); |
| @@ -756,7 +859,9 @@ _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " | |||
| 756 | Returns TEMPLATE, or a null pointer if it cannot get a unique name. | 859 | Returns TEMPLATE, or a null pointer if it cannot get a unique name. |
| 757 | The directory is created mode 700. */ | 860 | The directory is created mode 700. */ |
| 758 | # if !@HAVE_MKDTEMP@ | 861 | # if !@HAVE_MKDTEMP@ |
| 759 | _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); | 862 | _GL_FUNCDECL_SYS (mkdtemp, char *, |
| 863 | (char * /*template*/), | ||
| 864 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); | ||
| 760 | # endif | 865 | # endif |
| 761 | _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); | 866 | _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); |
| 762 | _GL_CXXALIASWARN (mkdtemp); | 867 | _GL_CXXALIASWARN (mkdtemp); |
| @@ -786,13 +891,13 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " | |||
| 786 | # undef mkostemp | 891 | # undef mkostemp |
| 787 | # define mkostemp rpl_mkostemp | 892 | # define mkostemp rpl_mkostemp |
| 788 | # endif | 893 | # endif |
| 789 | _GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/) | 894 | _GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/), |
| 790 | _GL_ARG_NONNULL ((1))); | 895 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); |
| 791 | _GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)); | 896 | _GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)); |
| 792 | # else | 897 | # else |
| 793 | # if !@HAVE_MKOSTEMP@ | 898 | # if !@HAVE_MKOSTEMP@ |
| 794 | _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) | 899 | _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/), |
| 795 | _GL_ARG_NONNULL ((1))); | 900 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); |
| 796 | # endif | 901 | # endif |
| 797 | _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); | 902 | _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); |
| 798 | # endif | 903 | # endif |
| @@ -827,15 +932,15 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " | |||
| 827 | # define mkostemps rpl_mkostemps | 932 | # define mkostemps rpl_mkostemps |
| 828 | # endif | 933 | # endif |
| 829 | _GL_FUNCDECL_RPL (mkostemps, int, | 934 | _GL_FUNCDECL_RPL (mkostemps, int, |
| 830 | (char * /*template*/, int /*suffixlen*/, int /*flags*/) | 935 | (char * /*template*/, int /*suffixlen*/, int /*flags*/), |
| 831 | _GL_ARG_NONNULL ((1))); | 936 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); |
| 832 | _GL_CXXALIAS_RPL (mkostemps, int, | 937 | _GL_CXXALIAS_RPL (mkostemps, int, |
| 833 | (char * /*template*/, int /*suffixlen*/, int /*flags*/)); | 938 | (char * /*template*/, int /*suffixlen*/, int /*flags*/)); |
| 834 | # else | 939 | # else |
| 835 | # if !@HAVE_MKOSTEMPS@ | 940 | # if !@HAVE_MKOSTEMPS@ |
| 836 | _GL_FUNCDECL_SYS (mkostemps, int, | 941 | _GL_FUNCDECL_SYS (mkostemps, int, |
| 837 | (char * /*template*/, int /*suffixlen*/, int /*flags*/) | 942 | (char * /*template*/, int /*suffixlen*/, int /*flags*/), |
| 838 | _GL_ARG_NONNULL ((1))); | 943 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); |
| 839 | # endif | 944 | # endif |
| 840 | _GL_CXXALIAS_SYS (mkostemps, int, | 945 | _GL_CXXALIAS_SYS (mkostemps, int, |
| 841 | (char * /*template*/, int /*suffixlen*/, int /*flags*/)); | 946 | (char * /*template*/, int /*suffixlen*/, int /*flags*/)); |
| @@ -865,11 +970,13 @@ _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " | |||
| 865 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 970 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 866 | # define mkstemp rpl_mkstemp | 971 | # define mkstemp rpl_mkstemp |
| 867 | # endif | 972 | # endif |
| 868 | _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); | 973 | _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/), |
| 974 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); | ||
| 869 | _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); | 975 | _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); |
| 870 | # else | 976 | # else |
| 871 | # if ! @HAVE_MKSTEMP@ | 977 | # if ! @HAVE_MKSTEMP@ |
| 872 | _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); | 978 | _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/), |
| 979 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); | ||
| 873 | # endif | 980 | # endif |
| 874 | _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); | 981 | _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); |
| 875 | # endif | 982 | # endif |
| @@ -894,8 +1001,8 @@ _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " | |||
| 894 | Returns the open file descriptor if successful, otherwise -1 and errno | 1001 | Returns the open file descriptor if successful, otherwise -1 and errno |
| 895 | set. */ | 1002 | set. */ |
| 896 | # if !@HAVE_MKSTEMPS@ | 1003 | # if !@HAVE_MKSTEMPS@ |
| 897 | _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) | 1004 | _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/), |
| 898 | _GL_ARG_NONNULL ((1))); | 1005 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); |
| 899 | # endif | 1006 | # endif |
| 900 | _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); | 1007 | _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); |
| 901 | _GL_CXXALIASWARN (mkstemps); | 1008 | _GL_CXXALIASWARN (mkstemps); |
| @@ -931,8 +1038,8 @@ _GL_CXXALIASWARN (mktemp); | |||
| 931 | # define posix_memalign rpl_posix_memalign | 1038 | # define posix_memalign rpl_posix_memalign |
| 932 | # endif | 1039 | # endif |
| 933 | _GL_FUNCDECL_RPL (posix_memalign, int, | 1040 | _GL_FUNCDECL_RPL (posix_memalign, int, |
| 934 | (void **memptr, size_t alignment, size_t size) | 1041 | (void **memptr, size_t alignment, size_t size), |
| 935 | _GL_ARG_NONNULL ((1))); | 1042 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); |
| 936 | _GL_CXXALIAS_RPL (posix_memalign, int, | 1043 | _GL_CXXALIAS_RPL (posix_memalign, int, |
| 937 | (void **memptr, size_t alignment, size_t size)); | 1044 | (void **memptr, size_t alignment, size_t size)); |
| 938 | # else | 1045 | # else |
| @@ -960,11 +1067,11 @@ _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " | |||
| 960 | # undef posix_openpt | 1067 | # undef posix_openpt |
| 961 | # define posix_openpt rpl_posix_openpt | 1068 | # define posix_openpt rpl_posix_openpt |
| 962 | # endif | 1069 | # endif |
| 963 | _GL_FUNCDECL_RPL (posix_openpt, int, (int flags)); | 1070 | _GL_FUNCDECL_RPL (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); |
| 964 | _GL_CXXALIAS_RPL (posix_openpt, int, (int flags)); | 1071 | _GL_CXXALIAS_RPL (posix_openpt, int, (int flags)); |
| 965 | # else | 1072 | # else |
| 966 | # if !@HAVE_POSIX_OPENPT@ | 1073 | # if !@HAVE_POSIX_OPENPT@ |
| 967 | _GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); | 1074 | _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); |
| 968 | # endif | 1075 | # endif |
| 969 | _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); | 1076 | _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); |
| 970 | # endif | 1077 | # endif |
| @@ -987,11 +1094,11 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " | |||
| 987 | # undef ptsname | 1094 | # undef ptsname |
| 988 | # define ptsname rpl_ptsname | 1095 | # define ptsname rpl_ptsname |
| 989 | # endif | 1096 | # endif |
| 990 | _GL_FUNCDECL_RPL (ptsname, char *, (int fd)); | 1097 | _GL_FUNCDECL_RPL (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD); |
| 991 | _GL_CXXALIAS_RPL (ptsname, char *, (int fd)); | 1098 | _GL_CXXALIAS_RPL (ptsname, char *, (int fd)); |
| 992 | # else | 1099 | # else |
| 993 | # if !@HAVE_PTSNAME@ | 1100 | # if !@HAVE_PTSNAME@ |
| 994 | _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); | 1101 | _GL_FUNCDECL_SYS (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD); |
| 995 | # endif | 1102 | # endif |
| 996 | _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); | 1103 | _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); |
| 997 | # endif | 1104 | # endif |
| @@ -1013,11 +1120,11 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " | |||
| 1013 | # undef ptsname_r | 1120 | # undef ptsname_r |
| 1014 | # define ptsname_r rpl_ptsname_r | 1121 | # define ptsname_r rpl_ptsname_r |
| 1015 | # endif | 1122 | # endif |
| 1016 | _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); | 1123 | _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len), ); |
| 1017 | _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); | 1124 | _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); |
| 1018 | # else | 1125 | # else |
| 1019 | # if !@HAVE_PTSNAME_R@ | 1126 | # if !@HAVE_PTSNAME_R@ |
| 1020 | _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); | 1127 | _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len), ); |
| 1021 | # endif | 1128 | # endif |
| 1022 | _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); | 1129 | _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); |
| 1023 | # endif | 1130 | # endif |
| @@ -1039,7 +1146,7 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " | |||
| 1039 | # undef putenv | 1146 | # undef putenv |
| 1040 | # define putenv rpl_putenv | 1147 | # define putenv rpl_putenv |
| 1041 | # endif | 1148 | # endif |
| 1042 | _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); | 1149 | _GL_FUNCDECL_RPL (putenv, int, (char *string), _GL_ARG_NONNULL ((1))); |
| 1043 | _GL_CXXALIAS_RPL (putenv, int, (char *string)); | 1150 | _GL_CXXALIAS_RPL (putenv, int, (char *string)); |
| 1044 | # elif defined _WIN32 && !defined __CYGWIN__ | 1151 | # elif defined _WIN32 && !defined __CYGWIN__ |
| 1045 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1152 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| @@ -1098,7 +1205,9 @@ typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *); | |||
| 1098 | # endif | 1205 | # endif |
| 1099 | _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, | 1206 | _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, |
| 1100 | _gl_qsort_r_compar_fn compare, | 1207 | _gl_qsort_r_compar_fn compare, |
| 1101 | void *arg) _GL_ARG_NONNULL ((1, 4))); | 1208 | void *arg), |
| 1209 | _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) | ||
| 1210 | _GL_ARG_NONNULL ((4))); | ||
| 1102 | _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, | 1211 | _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, |
| 1103 | _gl_qsort_r_compar_fn compare, | 1212 | _gl_qsort_r_compar_fn compare, |
| 1104 | void *arg)); | 1213 | void *arg)); |
| @@ -1106,7 +1215,9 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, | |||
| 1106 | # if !@HAVE_QSORT_R@ | 1215 | # if !@HAVE_QSORT_R@ |
| 1107 | _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, | 1216 | _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, |
| 1108 | _gl_qsort_r_compar_fn compare, | 1217 | _gl_qsort_r_compar_fn compare, |
| 1109 | void *arg) _GL_ARG_NONNULL ((1, 4))); | 1218 | void *arg), |
| 1219 | _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) | ||
| 1220 | _GL_ARG_NONNULL ((4))); | ||
| 1110 | # endif | 1221 | # endif |
| 1111 | _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, | 1222 | _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, |
| 1112 | _gl_qsort_r_compar_fn compare, | 1223 | _gl_qsort_r_compar_fn compare, |
| @@ -1137,7 +1248,7 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " | |||
| 1137 | # undef rand | 1248 | # undef rand |
| 1138 | # define rand rpl_rand | 1249 | # define rand rpl_rand |
| 1139 | # endif | 1250 | # endif |
| 1140 | _GL_FUNCDECL_RPL (rand, int, (void)); | 1251 | _GL_FUNCDECL_RPL (rand, int, (void), ); |
| 1141 | _GL_CXXALIAS_RPL (rand, int, (void)); | 1252 | _GL_CXXALIAS_RPL (rand, int, (void)); |
| 1142 | # else | 1253 | # else |
| 1143 | _GL_CXXALIAS_SYS (rand, int, (void)); | 1254 | _GL_CXXALIAS_SYS (rand, int, (void)); |
| @@ -1154,11 +1265,11 @@ _GL_CXXALIASWARN (rand); | |||
| 1154 | # undef random | 1265 | # undef random |
| 1155 | # define random rpl_random | 1266 | # define random rpl_random |
| 1156 | # endif | 1267 | # endif |
| 1157 | _GL_FUNCDECL_RPL (random, long, (void)); | 1268 | _GL_FUNCDECL_RPL (random, long, (void), ); |
| 1158 | _GL_CXXALIAS_RPL (random, long, (void)); | 1269 | _GL_CXXALIAS_RPL (random, long, (void)); |
| 1159 | # else | 1270 | # else |
| 1160 | # if !@HAVE_RANDOM@ | 1271 | # if !@HAVE_RANDOM@ |
| 1161 | _GL_FUNCDECL_SYS (random, long, (void)); | 1272 | _GL_FUNCDECL_SYS (random, long, (void), ); |
| 1162 | # endif | 1273 | # endif |
| 1163 | /* Need to cast, because on Haiku, the return type is | 1274 | /* Need to cast, because on Haiku, the return type is |
| 1164 | int. */ | 1275 | int. */ |
| @@ -1181,11 +1292,11 @@ _GL_WARN_ON_USE (random, "random is unportable - " | |||
| 1181 | # undef srandom | 1292 | # undef srandom |
| 1182 | # define srandom rpl_srandom | 1293 | # define srandom rpl_srandom |
| 1183 | # endif | 1294 | # endif |
| 1184 | _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); | 1295 | _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed), ); |
| 1185 | _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); | 1296 | _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); |
| 1186 | # else | 1297 | # else |
| 1187 | # if !@HAVE_RANDOM@ | 1298 | # if !@HAVE_RANDOM@ |
| 1188 | _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); | 1299 | _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed), ); |
| 1189 | # endif | 1300 | # endif |
| 1190 | /* Need to cast, because on FreeBSD, the first parameter is | 1301 | /* Need to cast, because on FreeBSD, the first parameter is |
| 1191 | unsigned long seed. */ | 1302 | unsigned long seed. */ |
| @@ -1209,14 +1320,14 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - " | |||
| 1209 | # define initstate rpl_initstate | 1320 | # define initstate rpl_initstate |
| 1210 | # endif | 1321 | # endif |
| 1211 | _GL_FUNCDECL_RPL (initstate, char *, | 1322 | _GL_FUNCDECL_RPL (initstate, char *, |
| 1212 | (unsigned int seed, char *buf, size_t buf_size) | 1323 | (unsigned int seed, char *buf, size_t buf_size), |
| 1213 | _GL_ARG_NONNULL ((2))); | 1324 | _GL_ARG_NONNULL ((2))); |
| 1214 | _GL_CXXALIAS_RPL (initstate, char *, | 1325 | _GL_CXXALIAS_RPL (initstate, char *, |
| 1215 | (unsigned int seed, char *buf, size_t buf_size)); | 1326 | (unsigned int seed, char *buf, size_t buf_size)); |
| 1216 | # else | 1327 | # else |
| 1217 | # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ | 1328 | # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ |
| 1218 | _GL_FUNCDECL_SYS (initstate, char *, | 1329 | _GL_FUNCDECL_SYS (initstate, char *, |
| 1219 | (unsigned int seed, char *buf, size_t buf_size) | 1330 | (unsigned int seed, char *buf, size_t buf_size), |
| 1220 | _GL_ARG_NONNULL ((2))); | 1331 | _GL_ARG_NONNULL ((2))); |
| 1221 | # endif | 1332 | # endif |
| 1222 | /* Need to cast, because on FreeBSD, the first parameter is | 1333 | /* Need to cast, because on FreeBSD, the first parameter is |
| @@ -1241,11 +1352,11 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - " | |||
| 1241 | # undef setstate | 1352 | # undef setstate |
| 1242 | # define setstate rpl_setstate | 1353 | # define setstate rpl_setstate |
| 1243 | # endif | 1354 | # endif |
| 1244 | _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); | 1355 | _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1))); |
| 1245 | _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); | 1356 | _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); |
| 1246 | # else | 1357 | # else |
| 1247 | # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ | 1358 | # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ |
| 1248 | _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); | 1359 | _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1))); |
| 1249 | # endif | 1360 | # endif |
| 1250 | /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter | 1361 | /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter |
| 1251 | is const char *arg_state. */ | 1362 | is const char *arg_state. */ |
| @@ -1269,12 +1380,12 @@ _GL_WARN_ON_USE (setstate, "setstate is unportable - " | |||
| 1269 | # undef random_r | 1380 | # undef random_r |
| 1270 | # define random_r rpl_random_r | 1381 | # define random_r rpl_random_r |
| 1271 | # endif | 1382 | # endif |
| 1272 | _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) | 1383 | _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result), |
| 1273 | _GL_ARG_NONNULL ((1, 2))); | 1384 | _GL_ARG_NONNULL ((1, 2))); |
| 1274 | _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); | 1385 | _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); |
| 1275 | # else | 1386 | # else |
| 1276 | # if !@HAVE_RANDOM_R@ | 1387 | # if !@HAVE_RANDOM_R@ |
| 1277 | _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) | 1388 | _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result), |
| 1278 | _GL_ARG_NONNULL ((1, 2))); | 1389 | _GL_ARG_NONNULL ((1, 2))); |
| 1279 | # endif | 1390 | # endif |
| 1280 | _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); | 1391 | _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); |
| @@ -1295,14 +1406,14 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - " | |||
| 1295 | # define srandom_r rpl_srandom_r | 1406 | # define srandom_r rpl_srandom_r |
| 1296 | # endif | 1407 | # endif |
| 1297 | _GL_FUNCDECL_RPL (srandom_r, int, | 1408 | _GL_FUNCDECL_RPL (srandom_r, int, |
| 1298 | (unsigned int seed, struct random_data *rand_state) | 1409 | (unsigned int seed, struct random_data *rand_state), |
| 1299 | _GL_ARG_NONNULL ((2))); | 1410 | _GL_ARG_NONNULL ((2))); |
| 1300 | _GL_CXXALIAS_RPL (srandom_r, int, | 1411 | _GL_CXXALIAS_RPL (srandom_r, int, |
| 1301 | (unsigned int seed, struct random_data *rand_state)); | 1412 | (unsigned int seed, struct random_data *rand_state)); |
| 1302 | # else | 1413 | # else |
| 1303 | # if !@HAVE_RANDOM_R@ | 1414 | # if !@HAVE_RANDOM_R@ |
| 1304 | _GL_FUNCDECL_SYS (srandom_r, int, | 1415 | _GL_FUNCDECL_SYS (srandom_r, int, |
| 1305 | (unsigned int seed, struct random_data *rand_state) | 1416 | (unsigned int seed, struct random_data *rand_state), |
| 1306 | _GL_ARG_NONNULL ((2))); | 1417 | _GL_ARG_NONNULL ((2))); |
| 1307 | # endif | 1418 | # endif |
| 1308 | _GL_CXXALIAS_SYS (srandom_r, int, | 1419 | _GL_CXXALIAS_SYS (srandom_r, int, |
| @@ -1325,7 +1436,7 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " | |||
| 1325 | # endif | 1436 | # endif |
| 1326 | _GL_FUNCDECL_RPL (initstate_r, int, | 1437 | _GL_FUNCDECL_RPL (initstate_r, int, |
| 1327 | (unsigned int seed, char *buf, size_t buf_size, | 1438 | (unsigned int seed, char *buf, size_t buf_size, |
| 1328 | struct random_data *rand_state) | 1439 | struct random_data *rand_state), |
| 1329 | _GL_ARG_NONNULL ((2, 4))); | 1440 | _GL_ARG_NONNULL ((2, 4))); |
| 1330 | _GL_CXXALIAS_RPL (initstate_r, int, | 1441 | _GL_CXXALIAS_RPL (initstate_r, int, |
| 1331 | (unsigned int seed, char *buf, size_t buf_size, | 1442 | (unsigned int seed, char *buf, size_t buf_size, |
| @@ -1334,7 +1445,7 @@ _GL_CXXALIAS_RPL (initstate_r, int, | |||
| 1334 | # if !@HAVE_RANDOM_R@ | 1445 | # if !@HAVE_RANDOM_R@ |
| 1335 | _GL_FUNCDECL_SYS (initstate_r, int, | 1446 | _GL_FUNCDECL_SYS (initstate_r, int, |
| 1336 | (unsigned int seed, char *buf, size_t buf_size, | 1447 | (unsigned int seed, char *buf, size_t buf_size, |
| 1337 | struct random_data *rand_state) | 1448 | struct random_data *rand_state), |
| 1338 | _GL_ARG_NONNULL ((2, 4))); | 1449 | _GL_ARG_NONNULL ((2, 4))); |
| 1339 | # endif | 1450 | # endif |
| 1340 | /* Need to cast, because on Haiku, the third parameter is | 1451 | /* Need to cast, because on Haiku, the third parameter is |
| @@ -1359,14 +1470,14 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " | |||
| 1359 | # define setstate_r rpl_setstate_r | 1470 | # define setstate_r rpl_setstate_r |
| 1360 | # endif | 1471 | # endif |
| 1361 | _GL_FUNCDECL_RPL (setstate_r, int, | 1472 | _GL_FUNCDECL_RPL (setstate_r, int, |
| 1362 | (char *arg_state, struct random_data *rand_state) | 1473 | (char *arg_state, struct random_data *rand_state), |
| 1363 | _GL_ARG_NONNULL ((1, 2))); | 1474 | _GL_ARG_NONNULL ((1, 2))); |
| 1364 | _GL_CXXALIAS_RPL (setstate_r, int, | 1475 | _GL_CXXALIAS_RPL (setstate_r, int, |
| 1365 | (char *arg_state, struct random_data *rand_state)); | 1476 | (char *arg_state, struct random_data *rand_state)); |
| 1366 | # else | 1477 | # else |
| 1367 | # if !@HAVE_RANDOM_R@ | 1478 | # if !@HAVE_RANDOM_R@ |
| 1368 | _GL_FUNCDECL_SYS (setstate_r, int, | 1479 | _GL_FUNCDECL_SYS (setstate_r, int, |
| 1369 | (char *arg_state, struct random_data *rand_state) | 1480 | (char *arg_state, struct random_data *rand_state), |
| 1370 | _GL_ARG_NONNULL ((1, 2))); | 1481 | _GL_ARG_NONNULL ((1, 2))); |
| 1371 | # endif | 1482 | # endif |
| 1372 | /* Need to cast, because on Haiku, the first parameter is | 1483 | /* Need to cast, because on Haiku, the first parameter is |
| @@ -1385,28 +1496,44 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " | |||
| 1385 | 1496 | ||
| 1386 | 1497 | ||
| 1387 | #if @GNULIB_REALLOC_POSIX@ | 1498 | #if @GNULIB_REALLOC_POSIX@ |
| 1388 | # if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \ | 1499 | # if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ |
| 1389 | || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@) | 1500 | # if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2 |
| 1501 | # define _GL_INLINE_RPL_REALLOC 1 | ||
| 1502 | # ifdef __cplusplus | ||
| 1503 | extern "C" { | ||
| 1504 | # endif | ||
| 1505 | _GL_REALLOC_INLINE void * | ||
| 1506 | rpl_realloc (void *ptr, size_t size) | ||
| 1507 | { | ||
| 1508 | return realloc (ptr, size ? size : 1); | ||
| 1509 | } | ||
| 1510 | # ifdef __cplusplus | ||
| 1511 | } | ||
| 1512 | # endif | ||
| 1513 | # endif | ||
| 1390 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ | 1514 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ |
| 1391 | || _GL_USE_STDLIB_ALLOC) | 1515 | || _GL_USE_STDLIB_ALLOC) |
| 1392 | # undef realloc | 1516 | # undef realloc |
| 1393 | # define realloc rpl_realloc | 1517 | # define realloc rpl_realloc |
| 1394 | # endif | 1518 | # endif |
| 1395 | _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) | 1519 | # if !defined _GL_INLINE_RPL_REALLOC |
| 1396 | _GL_ATTRIBUTE_DEALLOC_FREE); | 1520 | _GL_FUNCDECL_RPL (realloc, void *, |
| 1521 | (void *ptr, size_t size), | ||
| 1522 | _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD); | ||
| 1523 | # endif | ||
| 1397 | _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); | 1524 | _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); |
| 1398 | # else | 1525 | # else |
| 1399 | # if __GNUC__ >= 11 | 1526 | # if __GNUC__ >= 11 && !defined __clang__ |
| 1400 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ | 1527 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ |
| 1401 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | 1528 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 |
| 1402 | _GL_FUNCDECL_SYS (realloc, void *, | 1529 | _GL_FUNCDECL_SYS (realloc, void *, |
| 1403 | (void *ptr, size_t size) | 1530 | (void *ptr, size_t size), |
| 1404 | _GL_ATTRIBUTE_NOTHROW | 1531 | _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD) |
| 1405 | _GL_ATTRIBUTE_DEALLOC_FREE); | 1532 | _GL_ATTRIBUTE_NOTHROW; |
| 1406 | # else | 1533 | # else |
| 1407 | _GL_FUNCDECL_SYS (realloc, void *, | 1534 | _GL_FUNCDECL_SYS (realloc, void *, |
| 1408 | (void *ptr, size_t size) | 1535 | (void *ptr, size_t size), |
| 1409 | _GL_ATTRIBUTE_DEALLOC_FREE); | 1536 | _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD); |
| 1410 | # endif | 1537 | # endif |
| 1411 | # endif | 1538 | # endif |
| 1412 | _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); | 1539 | _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); |
| @@ -1415,16 +1542,17 @@ _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); | |||
| 1415 | _GL_CXXALIASWARN (realloc); | 1542 | _GL_CXXALIASWARN (realloc); |
| 1416 | # endif | 1543 | # endif |
| 1417 | #else | 1544 | #else |
| 1418 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc | 1545 | # if @GNULIB_FREE_POSIX@ \ |
| 1546 | && (__GNUC__ >= 11 && !defined __clang__) && !defined realloc | ||
| 1419 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ | 1547 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ |
| 1420 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 | 1548 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 |
| 1421 | _GL_FUNCDECL_SYS (realloc, void *, | 1549 | _GL_FUNCDECL_SYS (realloc, void *, |
| 1422 | (void *ptr, size_t size) | 1550 | (void *ptr, size_t size), |
| 1423 | _GL_ATTRIBUTE_NOTHROW | 1551 | _GL_ATTRIBUTE_DEALLOC_FREE) |
| 1424 | _GL_ATTRIBUTE_DEALLOC_FREE); | 1552 | _GL_ATTRIBUTE_NOTHROW; |
| 1425 | # else | 1553 | # else |
| 1426 | _GL_FUNCDECL_SYS (realloc, void *, | 1554 | _GL_FUNCDECL_SYS (realloc, void *, |
| 1427 | (void *ptr, size_t size) | 1555 | (void *ptr, size_t size), |
| 1428 | _GL_ATTRIBUTE_DEALLOC_FREE); | 1556 | _GL_ATTRIBUTE_DEALLOC_FREE); |
| 1429 | # endif | 1557 | # endif |
| 1430 | # endif | 1558 | # endif |
| @@ -1444,13 +1572,15 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " | |||
| 1444 | # define reallocarray rpl_reallocarray | 1572 | # define reallocarray rpl_reallocarray |
| 1445 | # endif | 1573 | # endif |
| 1446 | _GL_FUNCDECL_RPL (reallocarray, void *, | 1574 | _GL_FUNCDECL_RPL (reallocarray, void *, |
| 1447 | (void *ptr, size_t nmemb, size_t size)); | 1575 | (void *ptr, size_t nmemb, size_t size), |
| 1576 | _GL_ATTRIBUTE_NODISCARD); | ||
| 1448 | _GL_CXXALIAS_RPL (reallocarray, void *, | 1577 | _GL_CXXALIAS_RPL (reallocarray, void *, |
| 1449 | (void *ptr, size_t nmemb, size_t size)); | 1578 | (void *ptr, size_t nmemb, size_t size)); |
| 1450 | # else | 1579 | # else |
| 1451 | # if ! @HAVE_REALLOCARRAY@ | 1580 | # if ! @HAVE_REALLOCARRAY@ |
| 1452 | _GL_FUNCDECL_SYS (reallocarray, void *, | 1581 | _GL_FUNCDECL_SYS (reallocarray, void *, |
| 1453 | (void *ptr, size_t nmemb, size_t size)); | 1582 | (void *ptr, size_t nmemb, size_t size), |
| 1583 | _GL_ATTRIBUTE_NODISCARD); | ||
| 1454 | # endif | 1584 | # endif |
| 1455 | _GL_CXXALIAS_SYS (reallocarray, void *, | 1585 | _GL_CXXALIAS_SYS (reallocarray, void *, |
| 1456 | (void *ptr, size_t nmemb, size_t size)); | 1586 | (void *ptr, size_t nmemb, size_t size)); |
| @@ -1472,15 +1602,15 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " | |||
| 1472 | # define realpath rpl_realpath | 1602 | # define realpath rpl_realpath |
| 1473 | # endif | 1603 | # endif |
| 1474 | _GL_FUNCDECL_RPL (realpath, char *, | 1604 | _GL_FUNCDECL_RPL (realpath, char *, |
| 1475 | (const char *restrict name, char *restrict resolved) | 1605 | (const char *restrict name, char *restrict resolved), |
| 1476 | _GL_ARG_NONNULL ((1))); | 1606 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); |
| 1477 | _GL_CXXALIAS_RPL (realpath, char *, | 1607 | _GL_CXXALIAS_RPL (realpath, char *, |
| 1478 | (const char *restrict name, char *restrict resolved)); | 1608 | (const char *restrict name, char *restrict resolved)); |
| 1479 | # else | 1609 | # else |
| 1480 | # if !@HAVE_REALPATH@ | 1610 | # if !@HAVE_REALPATH@ |
| 1481 | _GL_FUNCDECL_SYS (realpath, char *, | 1611 | _GL_FUNCDECL_SYS (realpath, char *, |
| 1482 | (const char *restrict name, char *restrict resolved) | 1612 | (const char *restrict name, char *restrict resolved), |
| 1483 | _GL_ARG_NONNULL ((1))); | 1613 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); |
| 1484 | # endif | 1614 | # endif |
| 1485 | _GL_CXXALIAS_SYS (realpath, char *, | 1615 | _GL_CXXALIAS_SYS (realpath, char *, |
| 1486 | (const char *restrict name, char *restrict resolved)); | 1616 | (const char *restrict name, char *restrict resolved)); |
| @@ -1498,7 +1628,8 @@ _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " | |||
| 1498 | /* Test a user response to a question. | 1628 | /* Test a user response to a question. |
| 1499 | Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ | 1629 | Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ |
| 1500 | # if !@HAVE_RPMATCH@ | 1630 | # if !@HAVE_RPMATCH@ |
| 1501 | _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); | 1631 | _GL_FUNCDECL_SYS (rpmatch, int, (const char *response), |
| 1632 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); | ||
| 1502 | # endif | 1633 | # endif |
| 1503 | _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); | 1634 | _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); |
| 1504 | _GL_CXXALIASWARN (rpmatch); | 1635 | _GL_CXXALIASWARN (rpmatch); |
| @@ -1514,7 +1645,8 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " | |||
| 1514 | /* Look up NAME in the environment, returning 0 in insecure situations. */ | 1645 | /* Look up NAME in the environment, returning 0 in insecure situations. */ |
| 1515 | # if !@HAVE_SECURE_GETENV@ | 1646 | # if !@HAVE_SECURE_GETENV@ |
| 1516 | _GL_FUNCDECL_SYS (secure_getenv, char *, | 1647 | _GL_FUNCDECL_SYS (secure_getenv, char *, |
| 1517 | (char const *name) _GL_ARG_NONNULL ((1))); | 1648 | (char const *name), |
| 1649 | _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); | ||
| 1518 | # endif | 1650 | # endif |
| 1519 | _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); | 1651 | _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); |
| 1520 | _GL_CXXALIASWARN (secure_getenv); | 1652 | _GL_CXXALIASWARN (secure_getenv); |
| @@ -1535,14 +1667,14 @@ _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " | |||
| 1535 | # define setenv rpl_setenv | 1667 | # define setenv rpl_setenv |
| 1536 | # endif | 1668 | # endif |
| 1537 | _GL_FUNCDECL_RPL (setenv, int, | 1669 | _GL_FUNCDECL_RPL (setenv, int, |
| 1538 | (const char *name, const char *value, int replace) | 1670 | (const char *name, const char *value, int replace), |
| 1539 | _GL_ARG_NONNULL ((1))); | 1671 | _GL_ARG_NONNULL ((1))); |
| 1540 | _GL_CXXALIAS_RPL (setenv, int, | 1672 | _GL_CXXALIAS_RPL (setenv, int, |
| 1541 | (const char *name, const char *value, int replace)); | 1673 | (const char *name, const char *value, int replace)); |
| 1542 | # else | 1674 | # else |
| 1543 | # if !@HAVE_DECL_SETENV@ | 1675 | # if !@HAVE_DECL_SETENV@ |
| 1544 | _GL_FUNCDECL_SYS (setenv, int, | 1676 | _GL_FUNCDECL_SYS (setenv, int, |
| 1545 | (const char *name, const char *value, int replace) | 1677 | (const char *name, const char *value, int replace), |
| 1546 | _GL_ARG_NONNULL ((1))); | 1678 | _GL_ARG_NONNULL ((1))); |
| 1547 | # endif | 1679 | # endif |
| 1548 | _GL_CXXALIAS_SYS (setenv, int, | 1680 | _GL_CXXALIAS_SYS (setenv, int, |
| @@ -1559,6 +1691,19 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - " | |||
| 1559 | # endif | 1691 | # endif |
| 1560 | #endif | 1692 | #endif |
| 1561 | 1693 | ||
| 1694 | #if @GNULIB_STACK_TRACE@ | ||
| 1695 | /* Prints a stack trace of the current thread to standard error, | ||
| 1696 | if possible. */ | ||
| 1697 | # if @CAN_PRINT_STACK_TRACE@ | ||
| 1698 | _GL_EXTERN_C void print_stack_trace (void); | ||
| 1699 | # else | ||
| 1700 | # if !GNULIB_defined_print_stack_trace | ||
| 1701 | # define print_stack_trace() /* nothing */ | ||
| 1702 | # define GNULIB_defined_print_stack_trace 1 | ||
| 1703 | # endif | ||
| 1704 | # endif | ||
| 1705 | #endif | ||
| 1706 | |||
| 1562 | #if @GNULIB_STRTOD@ | 1707 | #if @GNULIB_STRTOD@ |
| 1563 | /* Parse a double from STRING, updating ENDP if appropriate. */ | 1708 | /* Parse a double from STRING, updating ENDP if appropriate. */ |
| 1564 | # if @REPLACE_STRTOD@ | 1709 | # if @REPLACE_STRTOD@ |
| @@ -1567,14 +1712,14 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - " | |||
| 1567 | # endif | 1712 | # endif |
| 1568 | # define GNULIB_defined_strtod_function 1 | 1713 | # define GNULIB_defined_strtod_function 1 |
| 1569 | _GL_FUNCDECL_RPL (strtod, double, | 1714 | _GL_FUNCDECL_RPL (strtod, double, |
| 1570 | (const char *restrict str, char **restrict endp) | 1715 | (const char *restrict str, char **restrict endp), |
| 1571 | _GL_ARG_NONNULL ((1))); | 1716 | _GL_ARG_NONNULL ((1))); |
| 1572 | _GL_CXXALIAS_RPL (strtod, double, | 1717 | _GL_CXXALIAS_RPL (strtod, double, |
| 1573 | (const char *restrict str, char **restrict endp)); | 1718 | (const char *restrict str, char **restrict endp)); |
| 1574 | # else | 1719 | # else |
| 1575 | # if !@HAVE_STRTOD@ | 1720 | # if !@HAVE_STRTOD@ |
| 1576 | _GL_FUNCDECL_SYS (strtod, double, | 1721 | _GL_FUNCDECL_SYS (strtod, double, |
| 1577 | (const char *restrict str, char **restrict endp) | 1722 | (const char *restrict str, char **restrict endp), |
| 1578 | _GL_ARG_NONNULL ((1))); | 1723 | _GL_ARG_NONNULL ((1))); |
| 1579 | # endif | 1724 | # endif |
| 1580 | _GL_CXXALIAS_SYS (strtod, double, | 1725 | _GL_CXXALIAS_SYS (strtod, double, |
| @@ -1599,14 +1744,14 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " | |||
| 1599 | # endif | 1744 | # endif |
| 1600 | # define GNULIB_defined_strtof_function 1 | 1745 | # define GNULIB_defined_strtof_function 1 |
| 1601 | _GL_FUNCDECL_RPL (strtof, float, | 1746 | _GL_FUNCDECL_RPL (strtof, float, |
| 1602 | (const char *restrict str, char **restrict endp) | 1747 | (const char *restrict str, char **restrict endp), |
| 1603 | _GL_ARG_NONNULL ((1))); | 1748 | _GL_ARG_NONNULL ((1))); |
| 1604 | _GL_CXXALIAS_RPL (strtof, float, | 1749 | _GL_CXXALIAS_RPL (strtof, float, |
| 1605 | (const char *restrict str, char **restrict endp)); | 1750 | (const char *restrict str, char **restrict endp)); |
| 1606 | # else | 1751 | # else |
| 1607 | # if !@HAVE_STRTOF@ | 1752 | # if !@HAVE_STRTOF@ |
| 1608 | _GL_FUNCDECL_SYS (strtof, float, | 1753 | _GL_FUNCDECL_SYS (strtof, float, |
| 1609 | (const char *restrict str, char **restrict endp) | 1754 | (const char *restrict str, char **restrict endp), |
| 1610 | _GL_ARG_NONNULL ((1))); | 1755 | _GL_ARG_NONNULL ((1))); |
| 1611 | # endif | 1756 | # endif |
| 1612 | _GL_CXXALIAS_SYS (strtof, float, | 1757 | _GL_CXXALIAS_SYS (strtof, float, |
| @@ -1631,14 +1776,14 @@ _GL_WARN_ON_USE (strtof, "strtof is unportable - " | |||
| 1631 | # endif | 1776 | # endif |
| 1632 | # define GNULIB_defined_strtold_function 1 | 1777 | # define GNULIB_defined_strtold_function 1 |
| 1633 | _GL_FUNCDECL_RPL (strtold, long double, | 1778 | _GL_FUNCDECL_RPL (strtold, long double, |
| 1634 | (const char *restrict str, char **restrict endp) | 1779 | (const char *restrict str, char **restrict endp), |
| 1635 | _GL_ARG_NONNULL ((1))); | 1780 | _GL_ARG_NONNULL ((1))); |
| 1636 | _GL_CXXALIAS_RPL (strtold, long double, | 1781 | _GL_CXXALIAS_RPL (strtold, long double, |
| 1637 | (const char *restrict str, char **restrict endp)); | 1782 | (const char *restrict str, char **restrict endp)); |
| 1638 | # else | 1783 | # else |
| 1639 | # if !@HAVE_STRTOLD@ | 1784 | # if !@HAVE_STRTOLD@ |
| 1640 | _GL_FUNCDECL_SYS (strtold, long double, | 1785 | _GL_FUNCDECL_SYS (strtold, long double, |
| 1641 | (const char *restrict str, char **restrict endp) | 1786 | (const char *restrict str, char **restrict endp), |
| 1642 | _GL_ARG_NONNULL ((1))); | 1787 | _GL_ARG_NONNULL ((1))); |
| 1643 | # endif | 1788 | # endif |
| 1644 | _GL_CXXALIAS_SYS (strtold, long double, | 1789 | _GL_CXXALIAS_SYS (strtold, long double, |
| @@ -1669,7 +1814,7 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - " | |||
| 1669 | # define GNULIB_defined_strtol_function 1 | 1814 | # define GNULIB_defined_strtol_function 1 |
| 1670 | _GL_FUNCDECL_RPL (strtol, long, | 1815 | _GL_FUNCDECL_RPL (strtol, long, |
| 1671 | (const char *restrict string, char **restrict endptr, | 1816 | (const char *restrict string, char **restrict endptr, |
| 1672 | int base) | 1817 | int base), |
| 1673 | _GL_ARG_NONNULL ((1))); | 1818 | _GL_ARG_NONNULL ((1))); |
| 1674 | _GL_CXXALIAS_RPL (strtol, long, | 1819 | _GL_CXXALIAS_RPL (strtol, long, |
| 1675 | (const char *restrict string, char **restrict endptr, | 1820 | (const char *restrict string, char **restrict endptr, |
| @@ -1678,7 +1823,7 @@ _GL_CXXALIAS_RPL (strtol, long, | |||
| 1678 | # if !@HAVE_STRTOL@ | 1823 | # if !@HAVE_STRTOL@ |
| 1679 | _GL_FUNCDECL_SYS (strtol, long, | 1824 | _GL_FUNCDECL_SYS (strtol, long, |
| 1680 | (const char *restrict string, char **restrict endptr, | 1825 | (const char *restrict string, char **restrict endptr, |
| 1681 | int base) | 1826 | int base), |
| 1682 | _GL_ARG_NONNULL ((1))); | 1827 | _GL_ARG_NONNULL ((1))); |
| 1683 | # endif | 1828 | # endif |
| 1684 | _GL_CXXALIAS_SYS (strtol, long, | 1829 | _GL_CXXALIAS_SYS (strtol, long, |
| @@ -1712,7 +1857,7 @@ _GL_WARN_ON_USE (strtol, "strtol is unportable - " | |||
| 1712 | # define GNULIB_defined_strtoll_function 1 | 1857 | # define GNULIB_defined_strtoll_function 1 |
| 1713 | _GL_FUNCDECL_RPL (strtoll, long long, | 1858 | _GL_FUNCDECL_RPL (strtoll, long long, |
| 1714 | (const char *restrict string, char **restrict endptr, | 1859 | (const char *restrict string, char **restrict endptr, |
| 1715 | int base) | 1860 | int base), |
| 1716 | _GL_ARG_NONNULL ((1))); | 1861 | _GL_ARG_NONNULL ((1))); |
| 1717 | _GL_CXXALIAS_RPL (strtoll, long long, | 1862 | _GL_CXXALIAS_RPL (strtoll, long long, |
| 1718 | (const char *restrict string, char **restrict endptr, | 1863 | (const char *restrict string, char **restrict endptr, |
| @@ -1721,7 +1866,7 @@ _GL_CXXALIAS_RPL (strtoll, long long, | |||
| 1721 | # if !@HAVE_STRTOLL@ | 1866 | # if !@HAVE_STRTOLL@ |
| 1722 | _GL_FUNCDECL_SYS (strtoll, long long, | 1867 | _GL_FUNCDECL_SYS (strtoll, long long, |
| 1723 | (const char *restrict string, char **restrict endptr, | 1868 | (const char *restrict string, char **restrict endptr, |
| 1724 | int base) | 1869 | int base), |
| 1725 | _GL_ARG_NONNULL ((1))); | 1870 | _GL_ARG_NONNULL ((1))); |
| 1726 | # endif | 1871 | # endif |
| 1727 | _GL_CXXALIAS_SYS (strtoll, long long, | 1872 | _GL_CXXALIAS_SYS (strtoll, long long, |
| @@ -1752,7 +1897,7 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " | |||
| 1752 | # define GNULIB_defined_strtoul_function 1 | 1897 | # define GNULIB_defined_strtoul_function 1 |
| 1753 | _GL_FUNCDECL_RPL (strtoul, unsigned long, | 1898 | _GL_FUNCDECL_RPL (strtoul, unsigned long, |
| 1754 | (const char *restrict string, char **restrict endptr, | 1899 | (const char *restrict string, char **restrict endptr, |
| 1755 | int base) | 1900 | int base), |
| 1756 | _GL_ARG_NONNULL ((1))); | 1901 | _GL_ARG_NONNULL ((1))); |
| 1757 | _GL_CXXALIAS_RPL (strtoul, unsigned long, | 1902 | _GL_CXXALIAS_RPL (strtoul, unsigned long, |
| 1758 | (const char *restrict string, char **restrict endptr, | 1903 | (const char *restrict string, char **restrict endptr, |
| @@ -1761,7 +1906,7 @@ _GL_CXXALIAS_RPL (strtoul, unsigned long, | |||
| 1761 | # if !@HAVE_STRTOUL@ | 1906 | # if !@HAVE_STRTOUL@ |
| 1762 | _GL_FUNCDECL_SYS (strtoul, unsigned long, | 1907 | _GL_FUNCDECL_SYS (strtoul, unsigned long, |
| 1763 | (const char *restrict string, char **restrict endptr, | 1908 | (const char *restrict string, char **restrict endptr, |
| 1764 | int base) | 1909 | int base), |
| 1765 | _GL_ARG_NONNULL ((1))); | 1910 | _GL_ARG_NONNULL ((1))); |
| 1766 | # endif | 1911 | # endif |
| 1767 | _GL_CXXALIAS_SYS (strtoul, unsigned long, | 1912 | _GL_CXXALIAS_SYS (strtoul, unsigned long, |
| @@ -1795,7 +1940,7 @@ _GL_WARN_ON_USE (strtoul, "strtoul is unportable - " | |||
| 1795 | # define GNULIB_defined_strtoull_function 1 | 1940 | # define GNULIB_defined_strtoull_function 1 |
| 1796 | _GL_FUNCDECL_RPL (strtoull, unsigned long long, | 1941 | _GL_FUNCDECL_RPL (strtoull, unsigned long long, |
| 1797 | (const char *restrict string, char **restrict endptr, | 1942 | (const char *restrict string, char **restrict endptr, |
| 1798 | int base) | 1943 | int base), |
| 1799 | _GL_ARG_NONNULL ((1))); | 1944 | _GL_ARG_NONNULL ((1))); |
| 1800 | _GL_CXXALIAS_RPL (strtoull, unsigned long long, | 1945 | _GL_CXXALIAS_RPL (strtoull, unsigned long long, |
| 1801 | (const char *restrict string, char **restrict endptr, | 1946 | (const char *restrict string, char **restrict endptr, |
| @@ -1804,7 +1949,7 @@ _GL_CXXALIAS_RPL (strtoull, unsigned long long, | |||
| 1804 | # if !@HAVE_STRTOULL@ | 1949 | # if !@HAVE_STRTOULL@ |
| 1805 | _GL_FUNCDECL_SYS (strtoull, unsigned long long, | 1950 | _GL_FUNCDECL_SYS (strtoull, unsigned long long, |
| 1806 | (const char *restrict string, char **restrict endptr, | 1951 | (const char *restrict string, char **restrict endptr, |
| 1807 | int base) | 1952 | int base), |
| 1808 | _GL_ARG_NONNULL ((1))); | 1953 | _GL_ARG_NONNULL ((1))); |
| 1809 | # endif | 1954 | # endif |
| 1810 | _GL_CXXALIAS_SYS (strtoull, unsigned long long, | 1955 | _GL_CXXALIAS_SYS (strtoull, unsigned long long, |
| @@ -1824,7 +1969,7 @@ _GL_WARN_ON_USE (strtoull, "strtoull is unportable - " | |||
| 1824 | /* Unlock the slave side of the pseudo-terminal whose master side is specified | 1969 | /* Unlock the slave side of the pseudo-terminal whose master side is specified |
| 1825 | by FD, so that it can be opened. */ | 1970 | by FD, so that it can be opened. */ |
| 1826 | # if !@HAVE_UNLOCKPT@ | 1971 | # if !@HAVE_UNLOCKPT@ |
| 1827 | _GL_FUNCDECL_SYS (unlockpt, int, (int fd)); | 1972 | _GL_FUNCDECL_SYS (unlockpt, int, (int fd), ); |
| 1828 | # endif | 1973 | # endif |
| 1829 | _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); | 1974 | _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); |
| 1830 | _GL_CXXALIASWARN (unlockpt); | 1975 | _GL_CXXALIASWARN (unlockpt); |
| @@ -1843,11 +1988,11 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " | |||
| 1843 | # undef unsetenv | 1988 | # undef unsetenv |
| 1844 | # define unsetenv rpl_unsetenv | 1989 | # define unsetenv rpl_unsetenv |
| 1845 | # endif | 1990 | # endif |
| 1846 | _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); | 1991 | _GL_FUNCDECL_RPL (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1))); |
| 1847 | _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); | 1992 | _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); |
| 1848 | # else | 1993 | # else |
| 1849 | # if !@HAVE_DECL_UNSETENV@ | 1994 | # if !@HAVE_DECL_UNSETENV@ |
| 1850 | _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); | 1995 | _GL_FUNCDECL_SYS (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1))); |
| 1851 | # endif | 1996 | # endif |
| 1852 | _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); | 1997 | _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); |
| 1853 | # endif | 1998 | # endif |
| @@ -1869,7 +2014,7 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " | |||
| 1869 | # undef wctomb | 2014 | # undef wctomb |
| 1870 | # define wctomb rpl_wctomb | 2015 | # define wctomb rpl_wctomb |
| 1871 | # endif | 2016 | # endif |
| 1872 | _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); | 2017 | _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc), ); |
| 1873 | _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); | 2018 | _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); |
| 1874 | # else | 2019 | # else |
| 1875 | _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); | 2020 | _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); |
| @@ -1880,6 +2025,8 @@ _GL_CXXALIASWARN (wctomb); | |||
| 1880 | #endif | 2025 | #endif |
| 1881 | 2026 | ||
| 1882 | 2027 | ||
| 2028 | _GL_INLINE_HEADER_END | ||
| 2029 | |||
| 1883 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ | 2030 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ |
| 1884 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ | 2031 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ |
| 1885 | #endif | 2032 | #endif |
