summaryrefslogtreecommitdiffstats
path: root/gl/stdlib.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/stdlib.in.h')
-rw-r--r--gl/stdlib.in.h567
1 files changed, 336 insertions, 231 deletions
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index e74e7c18..95237f2a 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-2026 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,11 +62,6 @@
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>. */
51#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
52# include <sys/wait.h>
53#endif
54
55/* Solaris declares getloadavg() in <sys/loadavg.h>. */ 65/* Solaris declares getloadavg() in <sys/loadavg.h>. */
56#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ 66#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
57/* OpenIndiana has a bug: <sys/time.h> must be included before 67/* OpenIndiana has a bug: <sys/time.h> must be included before
@@ -60,6 +70,11 @@
60# include <sys/loadavg.h> 70# include <sys/loadavg.h>
61#endif 71#endif
62 72
73/* QNX declares getprogname() in <sys/process.h>. */
74#if (@GNULIB_GETPROGNAME@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_PROCESS_H@
75# include <sys/process.h>
76#endif
77
63/* Native Windows platforms declare _mktemp() in <io.h>. */ 78/* Native Windows platforms declare _mktemp() in <io.h>. */
64#if defined _WIN32 && !defined __CYGWIN__ 79#if defined _WIN32 && !defined __CYGWIN__
65# include <io.h> 80# include <io.h>
@@ -67,13 +82,6 @@
67 82
68#if @GNULIB_RANDOM_R@ 83#if @GNULIB_RANDOM_R@
69 84
70/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
71 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
72 'struct random_data'. */
73# if @HAVE_RANDOM_H@
74# include <random.h>
75# endif
76
77# include <stdint.h> 85# include <stdint.h>
78 86
79# if !@HAVE_STRUCT_RANDOM_DATA@ 87# if !@HAVE_STRUCT_RANDOM_DATA@
@@ -104,11 +112,30 @@ struct random_data
104# include <unistd.h> 112# include <unistd.h>
105#endif 113#endif
106 114
115#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)
116/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
117 below, this may cause compilation errors later in the libstdc++ header files
118 (that are part of GCC), such as:
119 error: 'rpl_strtol' is not a member of 'std'
120 To avoid this, include the relevant header files here, before these symbols
121 get defined as macros. But do so only on Solaris 11 and AIX (where it is
122 needed), not on mingw (where it would cause other compilation errors). */
123# include <string>
124#endif
125
126_GL_INLINE_HEADER_BEGIN
127#ifndef _GL_STDLIB_INLINE
128# define _GL_STDLIB_INLINE _GL_INLINE
129#endif
130#ifndef _GL_REALLOC_INLINE
131# define _GL_REALLOC_INLINE _GL_INLINE
132#endif
133
107/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers 134/* _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 135 that can be freed by passing them as the Ith argument to the
109 function F. */ 136 function F. */
110#ifndef _GL_ATTRIBUTE_DEALLOC 137#ifndef _GL_ATTRIBUTE_DEALLOC
111# if __GNUC__ >= 11 138# if __GNUC__ >= 11 && !defined __clang__
112# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 139# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
113# else 140# else
114# define _GL_ATTRIBUTE_DEALLOC(f, i) 141# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -133,11 +160,23 @@ struct random_data
133# endif 160# endif
134#endif 161#endif
135 162
163/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
164 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
165/* Applies to: functions. */
166#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
167# if __GNUC__ >= 15 && !defined __clang__
168# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
169 __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
170# else
171# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
172# endif
173#endif
174
136/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. 175/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
137 */ 176 */
138#ifndef _GL_ATTRIBUTE_NOTHROW 177#ifndef _GL_ATTRIBUTE_NOTHROW
139# if defined __cplusplus 178# if defined __cplusplus
140# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 179# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
141# if __cplusplus >= 201103L 180# if __cplusplus >= 201103L
142# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 181# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
143# else 182# else
@@ -188,6 +227,18 @@ struct random_data
188#endif 227#endif
189 228
190 229
230/* Declarations for ISO C N3322. */
231#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
232_GL_EXTERN_C void *_GL_FUNCDECL_SYS_NAME (bsearch)
233 (const void *__key, const void *__base, size_t __nmemb, size_t __size,
234 int (*__compare) (const void *, const void *))
235 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5));
236_GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size,
237 int (*__compare) (const void *, const void *))
238 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ARG_NONNULL ((4));
239#endif
240
241
191#if @GNULIB__EXIT@ 242#if @GNULIB__EXIT@
192/* Terminate the current process with the given return code, without running 243/* Terminate the current process with the given return code, without running
193 the 'atexit' handlers. */ 244 the 'atexit' handlers. */
@@ -196,11 +247,11 @@ struct random_data
196# undef _Exit 247# undef _Exit
197# define _Exit rpl__Exit 248# define _Exit rpl__Exit
198# endif 249# endif
199_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status)); 250_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status), );
200_GL_CXXALIAS_RPL (_Exit, void, (int status)); 251_GL_CXXALIAS_RPL (_Exit, void, (int status));
201# else 252# else
202# if !@HAVE__EXIT@ 253# if !@HAVE__EXIT@
203_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); 254_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status), );
204# endif 255# endif
205_GL_CXXALIAS_SYS (_Exit, void, (int status)); 256_GL_CXXALIAS_SYS (_Exit, void, (int status));
206# endif 257# endif
@@ -208,7 +259,6 @@ _GL_CXXALIAS_SYS (_Exit, void, (int status));
208_GL_CXXALIASWARN (_Exit); 259_GL_CXXALIASWARN (_Exit);
209# endif 260# endif
210#elif defined GNULIB_POSIXCHECK 261#elif defined GNULIB_POSIXCHECK
211# undef _Exit
212# if HAVE_RAW_DECL__EXIT 262# if HAVE_RAW_DECL__EXIT
213_GL_WARN_ON_USE (_Exit, "_Exit is unportable - " 263_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
214 "use gnulib module _Exit for portability"); 264 "use gnulib module _Exit for portability");
@@ -216,6 +266,26 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
216#endif 266#endif
217 267
218 268
269#if @GNULIB_ABORT_DEBUG@
270/* Terminates the current process with signal SIGABRT.
271 Note: While the original abort() function is safe to call in signal handlers,
272 the overridden abort() function is not. */
273# if @REPLACE_ABORT@
274# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
275# undef abort
276# define abort rpl_abort
277# endif
278_GL_FUNCDECL_RPL (abort, _Noreturn void, (void), );
279_GL_CXXALIAS_RPL (abort, void, (void));
280# else
281_GL_CXXALIAS_SYS (abort, void, (void));
282# endif
283# if __GLIBC__ >= 2
284_GL_CXXALIASWARN (abort);
285# endif
286#endif
287
288
219#if @GNULIB_FREE_POSIX@ 289#if @GNULIB_FREE_POSIX@
220# if @REPLACE_FREE@ 290# if @REPLACE_FREE@
221# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 291# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -223,9 +293,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
223# define free rpl_free 293# define free rpl_free
224# endif 294# endif
225# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) 295# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
226_GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW); 296_GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
227# else 297# else
228_GL_FUNCDECL_RPL (free, void, (void *ptr)); 298_GL_FUNCDECL_RPL (free, void, (void *ptr), );
229# endif 299# endif
230_GL_CXXALIAS_RPL (free, void, (void *ptr)); 300_GL_CXXALIAS_RPL (free, void, (void *ptr));
231# else 301# else
@@ -235,10 +305,9 @@ _GL_CXXALIAS_SYS (free, void, (void *ptr));
235_GL_CXXALIASWARN (free); 305_GL_CXXALIASWARN (free);
236# endif 306# endif
237#elif defined GNULIB_POSIXCHECK 307#elif defined GNULIB_POSIXCHECK
238# undef free
239/* Assume free is always declared. */ 308/* Assume free is always declared. */
240_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " 309_GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - "
241 "use gnulib module free for portability"); 310 "use gnulib module free-posix for portability");
242#endif 311#endif
243 312
244 313
@@ -250,22 +319,25 @@ _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
250# define aligned_alloc rpl_aligned_alloc 319# define aligned_alloc rpl_aligned_alloc
251# endif 320# endif
252_GL_FUNCDECL_RPL (aligned_alloc, void *, 321_GL_FUNCDECL_RPL (aligned_alloc, void *,
253 (size_t alignment, size_t size) 322 (size_t alignment, size_t size),
254 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 323 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
324 _GL_ATTRIBUTE_NODISCARD);
255_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); 325_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
256# else 326# else
257# if @HAVE_ALIGNED_ALLOC@ 327# if @HAVE_ALIGNED_ALLOC@
258# if __GNUC__ >= 11 328# if __GNUC__ >= 11 && !defined __clang__
259/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 329/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
260# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 330# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
261_GL_FUNCDECL_SYS (aligned_alloc, void *, 331_GL_FUNCDECL_SYS (aligned_alloc, void *,
262 (size_t alignment, size_t size) 332 (size_t alignment, size_t size),
263 _GL_ATTRIBUTE_NOTHROW 333 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
264 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 334 _GL_ATTRIBUTE_NODISCARD)
335 _GL_ATTRIBUTE_NOTHROW;
265# else 336# else
266_GL_FUNCDECL_SYS (aligned_alloc, void *, 337_GL_FUNCDECL_SYS (aligned_alloc, void *,
267 (size_t alignment, size_t size) 338 (size_t alignment, size_t size),
268 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 339 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
340 _GL_ATTRIBUTE_NODISCARD);
269# endif 341# endif
270# endif 342# endif
271_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); 343_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
@@ -275,21 +347,21 @@ _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
275_GL_CXXALIASWARN (aligned_alloc); 347_GL_CXXALIASWARN (aligned_alloc);
276# endif 348# endif
277#else 349#else
278# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc 350# if @GNULIB_FREE_POSIX@ \
351 && (__GNUC__ >= 11 && !defined __clang__) && !defined aligned_alloc
279/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 352/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
280# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 353# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
281_GL_FUNCDECL_SYS (aligned_alloc, void *, 354_GL_FUNCDECL_SYS (aligned_alloc, void *,
282 (size_t alignment, size_t size) 355 (size_t alignment, size_t size),
283 _GL_ATTRIBUTE_NOTHROW 356 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
284 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 357 _GL_ATTRIBUTE_NOTHROW;
285# else 358# else
286_GL_FUNCDECL_SYS (aligned_alloc, void *, 359_GL_FUNCDECL_SYS (aligned_alloc, void *,
287 (size_t alignment, size_t size) 360 (size_t alignment, size_t size),
288 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 361 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
289# endif 362# endif
290# endif 363# endif
291# if defined GNULIB_POSIXCHECK 364# if defined GNULIB_POSIXCHECK
292# undef aligned_alloc
293# if HAVE_RAW_DECL_ALIGNED_ALLOC 365# if HAVE_RAW_DECL_ALIGNED_ALLOC
294_GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " 366_GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
295 "use gnulib module aligned_alloc for portability"); 367 "use gnulib module aligned_alloc for portability");
@@ -301,14 +373,14 @@ _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
301/* Parse a signed decimal integer. 373/* Parse a signed decimal integer.
302 Returns the value of the integer. Errors are not detected. */ 374 Returns the value of the integer. Errors are not detected. */
303# if !@HAVE_ATOLL@ 375# if !@HAVE_ATOLL@
304_GL_FUNCDECL_SYS (atoll, long long, (const char *string) 376_GL_FUNCDECL_SYS (atoll, long long,
305 _GL_ATTRIBUTE_PURE 377 (const char *string),
306 _GL_ARG_NONNULL ((1))); 378 _GL_ATTRIBUTE_PURE
379 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
307# endif 380# endif
308_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 381_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
309_GL_CXXALIASWARN (atoll); 382_GL_CXXALIASWARN (atoll);
310#elif defined GNULIB_POSIXCHECK 383#elif defined GNULIB_POSIXCHECK
311# undef atoll
312# if HAVE_RAW_DECL_ATOLL 384# if HAVE_RAW_DECL_ATOLL
313_GL_WARN_ON_USE (atoll, "atoll is unportable - " 385_GL_WARN_ON_USE (atoll, "atoll is unportable - "
314 "use gnulib module atoll for portability"); 386 "use gnulib module atoll for portability");
@@ -316,28 +388,32 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
316#endif 388#endif
317 389
318#if @GNULIB_CALLOC_POSIX@ 390#if @GNULIB_CALLOC_POSIX@
319# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \ 391# if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \
320 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) 392 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
321# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 393# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
394 || _GL_USE_STDLIB_ALLOC)
322# undef calloc 395# undef calloc
323# define calloc rpl_calloc 396# define calloc rpl_calloc
324# endif 397# endif
325_GL_FUNCDECL_RPL (calloc, void *, 398_GL_FUNCDECL_RPL (calloc, void *,
326 (size_t nmemb, size_t size) 399 (size_t nmemb, size_t size),
327 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 400 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
401 _GL_ATTRIBUTE_NODISCARD);
328_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 402_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
329# else 403# else
330# if __GNUC__ >= 11 404# if __GNUC__ >= 11 && !defined __clang__
331/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 405/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
332# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 406# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
333_GL_FUNCDECL_SYS (calloc, void *, 407_GL_FUNCDECL_SYS (calloc, void *,
334 (size_t nmemb, size_t size) 408 (size_t nmemb, size_t size),
335 _GL_ATTRIBUTE_NOTHROW 409 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
336 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 410 _GL_ATTRIBUTE_NODISCARD)
411 _GL_ATTRIBUTE_NOTHROW;
337# else 412# else
338_GL_FUNCDECL_SYS (calloc, void *, 413_GL_FUNCDECL_SYS (calloc, void *,
339 (size_t nmemb, size_t size) 414 (size_t nmemb, size_t size),
340 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 415 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
416 _GL_ATTRIBUTE_NODISCARD);
341# endif 417# endif
342# endif 418# endif
343_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 419_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
@@ -346,21 +422,21 @@ _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
346_GL_CXXALIASWARN (calloc); 422_GL_CXXALIASWARN (calloc);
347# endif 423# endif
348#else 424#else
349# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc 425# if @GNULIB_FREE_POSIX@ \
426 && (__GNUC__ >= 11 && !defined __clang__) && !defined calloc
350/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 427/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
351# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 428# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
352_GL_FUNCDECL_SYS (calloc, void *, 429_GL_FUNCDECL_SYS (calloc, void *,
353 (size_t nmemb, size_t size) 430 (size_t nmemb, size_t size),
354 _GL_ATTRIBUTE_NOTHROW 431 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
355 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 432 _GL_ATTRIBUTE_NOTHROW;
356# else 433# else
357_GL_FUNCDECL_SYS (calloc, void *, 434_GL_FUNCDECL_SYS (calloc, void *,
358 (size_t nmemb, size_t size) 435 (size_t nmemb, size_t size),
359 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 436 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
360# endif 437# endif
361# endif 438# endif
362# if defined GNULIB_POSIXCHECK 439# if defined GNULIB_POSIXCHECK
363# undef calloc
364/* Assume calloc is always declared. */ 440/* Assume calloc is always declared. */
365_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " 441_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
366 "use gnulib module calloc-posix for portability"); 442 "use gnulib module calloc-posix for portability");
@@ -373,23 +449,26 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
373# define canonicalize_file_name rpl_canonicalize_file_name 449# define canonicalize_file_name rpl_canonicalize_file_name
374# endif 450# endif
375_GL_FUNCDECL_RPL (canonicalize_file_name, char *, 451_GL_FUNCDECL_RPL (canonicalize_file_name, char *,
376 (const char *name) 452 (const char *name),
377 _GL_ARG_NONNULL ((1)) 453 _GL_ARG_NONNULL ((1))
378 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 454 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
455 _GL_ATTRIBUTE_NODISCARD);
379_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 456_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
380# else 457# else
381# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 458# if !@HAVE_CANONICALIZE_FILE_NAME@ || (__GNUC__ >= 11 && !defined __clang__)
382# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 459# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
383_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 460_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
384 (const char *name) 461 (const char *name),
385 _GL_ATTRIBUTE_NOTHROW
386 _GL_ARG_NONNULL ((1)) 462 _GL_ARG_NONNULL ((1))
387 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 463 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
464 _GL_ATTRIBUTE_NODISCARD)
465 _GL_ATTRIBUTE_NOTHROW;
388# else 466# else
389_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 467_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
390 (const char *name) 468 (const char *name),
391 _GL_ARG_NONNULL ((1)) 469 _GL_ARG_NONNULL ((1))
392 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 470 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
471 _GL_ATTRIBUTE_NODISCARD);
393# endif 472# endif
394# endif 473# endif
395_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 474_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
@@ -400,24 +479,24 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
400# endif 479# endif
401_GL_CXXALIASWARN (canonicalize_file_name); 480_GL_CXXALIASWARN (canonicalize_file_name);
402#else 481#else
403# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name 482# if @GNULIB_FREE_POSIX@ \
483 && (__GNUC__ >= 11 && !defined __clang__) && !defined canonicalize_file_name
404/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or 484/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
405 rpl_free. */ 485 rpl_free. */
406# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 486# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
407_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 487_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
408 (const char *name) 488 (const char *name),
409 _GL_ATTRIBUTE_NOTHROW
410 _GL_ARG_NONNULL ((1)) 489 _GL_ARG_NONNULL ((1))
411 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 490 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
491 _GL_ATTRIBUTE_NOTHROW;
412# else 492# else
413_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 493_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
414 (const char *name) 494 (const char *name),
415 _GL_ARG_NONNULL ((1)) 495 _GL_ARG_NONNULL ((1))
416 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 496 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
417# endif 497# endif
418# endif 498# endif
419# if defined GNULIB_POSIXCHECK 499# if defined GNULIB_POSIXCHECK
420# undef canonicalize_file_name
421# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 500# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
422_GL_WARN_ON_USE (canonicalize_file_name, 501_GL_WARN_ON_USE (canonicalize_file_name,
423 "canonicalize_file_name is unportable - " 502 "canonicalize_file_name is unportable - "
@@ -503,12 +582,12 @@ _GL_CXXALIASWARN (gcvt);
503# undef getloadavg 582# undef getloadavg
504# define getloadavg rpl_getloadavg 583# define getloadavg rpl_getloadavg
505# endif 584# endif
506_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem) 585_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem),
507 _GL_ARG_NONNULL ((1))); 586 _GL_ARG_NONNULL ((1)));
508_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem)); 587_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
509# else 588# else
510# if !@HAVE_DECL_GETLOADAVG@ 589# if !@HAVE_DECL_GETLOADAVG@
511_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) 590_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem),
512 _GL_ARG_NONNULL ((1))); 591 _GL_ARG_NONNULL ((1)));
513# endif 592# endif
514_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); 593_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
@@ -517,7 +596,6 @@ _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
517_GL_CXXALIASWARN (getloadavg); 596_GL_CXXALIASWARN (getloadavg);
518# endif 597# endif
519#elif defined GNULIB_POSIXCHECK 598#elif defined GNULIB_POSIXCHECK
520# undef getloadavg
521# if HAVE_RAW_DECL_GETLOADAVG 599# if HAVE_RAW_DECL_GETLOADAVG
522_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " 600_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
523 "use gnulib module getloadavg for portability"); 601 "use gnulib module getloadavg for portability");
@@ -533,17 +611,17 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
533# define getprogname rpl_getprogname 611# define getprogname rpl_getprogname
534# endif 612# endif
535# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ 613# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
536_GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 614_GL_FUNCDECL_RPL (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
537# else 615# else
538_GL_FUNCDECL_RPL (getprogname, const char *, (void)); 616_GL_FUNCDECL_RPL (getprogname, const char *, (void), );
539# endif 617# endif
540_GL_CXXALIAS_RPL (getprogname, const char *, (void)); 618_GL_CXXALIAS_RPL (getprogname, const char *, (void));
541# else 619# else
542# if !@HAVE_GETPROGNAME@ 620# if !@HAVE_GETPROGNAME@
543# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ 621# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
544_GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 622_GL_FUNCDECL_SYS (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
545# else 623# else
546_GL_FUNCDECL_SYS (getprogname, const char *, (void)); 624_GL_FUNCDECL_SYS (getprogname, const char *, (void), );
547# endif 625# endif
548# endif 626# endif
549_GL_CXXALIAS_SYS (getprogname, const char *, (void)); 627_GL_CXXALIAS_SYS (getprogname, const char *, (void));
@@ -552,7 +630,6 @@ _GL_CXXALIAS_SYS (getprogname, const char *, (void));
552_GL_CXXALIASWARN (getprogname); 630_GL_CXXALIASWARN (getprogname);
553# endif 631# endif
554#elif defined GNULIB_POSIXCHECK 632#elif defined GNULIB_POSIXCHECK
555# undef getprogname
556# if HAVE_RAW_DECL_GETPROGNAME 633# if HAVE_RAW_DECL_GETPROGNAME
557_GL_WARN_ON_USE (getprogname, "getprogname is unportable - " 634_GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
558 "use gnulib module getprogname for portability"); 635 "use gnulib module getprogname for portability");
@@ -577,15 +654,15 @@ _GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
577# define getsubopt rpl_getsubopt 654# define getsubopt rpl_getsubopt
578# endif 655# endif
579_GL_FUNCDECL_RPL (getsubopt, int, 656_GL_FUNCDECL_RPL (getsubopt, int,
580 (char **optionp, char *const *tokens, char **valuep) 657 (char **optionp, char *const *tokens, char **valuep),
581 _GL_ARG_NONNULL ((1, 2, 3))); 658 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
582_GL_CXXALIAS_RPL (getsubopt, int, 659_GL_CXXALIAS_RPL (getsubopt, int,
583 (char **optionp, char *const *tokens, char **valuep)); 660 (char **optionp, char *const *tokens, char **valuep));
584# else 661# else
585# if !@HAVE_GETSUBOPT@ 662# if !@HAVE_GETSUBOPT@
586_GL_FUNCDECL_SYS (getsubopt, int, 663_GL_FUNCDECL_SYS (getsubopt, int,
587 (char **optionp, char *const *tokens, char **valuep) 664 (char **optionp, char *const *tokens, char **valuep),
588 _GL_ARG_NONNULL ((1, 2, 3))); 665 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
589# endif 666# endif
590_GL_CXXALIAS_SYS (getsubopt, int, 667_GL_CXXALIAS_SYS (getsubopt, int,
591 (char **optionp, char *const *tokens, char **valuep)); 668 (char **optionp, char *const *tokens, char **valuep));
@@ -594,7 +671,6 @@ _GL_CXXALIAS_SYS (getsubopt, int,
594_GL_CXXALIASWARN (getsubopt); 671_GL_CXXALIASWARN (getsubopt);
595# endif 672# endif
596#elif defined GNULIB_POSIXCHECK 673#elif defined GNULIB_POSIXCHECK
597# undef getsubopt
598# if HAVE_RAW_DECL_GETSUBOPT 674# if HAVE_RAW_DECL_GETSUBOPT
599_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " 675_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
600 "use gnulib module getsubopt for portability"); 676 "use gnulib module getsubopt for portability");
@@ -605,12 +681,11 @@ _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
605/* Change the ownership and access permission of the slave side of the 681/* Change the ownership and access permission of the slave side of the
606 pseudo-terminal whose master side is specified by FD. */ 682 pseudo-terminal whose master side is specified by FD. */
607# if !@HAVE_GRANTPT@ 683# if !@HAVE_GRANTPT@
608_GL_FUNCDECL_SYS (grantpt, int, (int fd)); 684_GL_FUNCDECL_SYS (grantpt, int, (int fd), );
609# endif 685# endif
610_GL_CXXALIAS_SYS (grantpt, int, (int fd)); 686_GL_CXXALIAS_SYS (grantpt, int, (int fd));
611_GL_CXXALIASWARN (grantpt); 687_GL_CXXALIASWARN (grantpt);
612#elif defined GNULIB_POSIXCHECK 688#elif defined GNULIB_POSIXCHECK
613# undef grantpt
614# if HAVE_RAW_DECL_GRANTPT 689# if HAVE_RAW_DECL_GRANTPT
615_GL_WARN_ON_USE (grantpt, "grantpt is not portable - " 690_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
616 "use gnulib module grantpt for portability"); 691 "use gnulib module grantpt for portability");
@@ -622,7 +697,7 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
622 by never specifying a zero size), so it does not need malloc or 697 by never specifying a zero size), so it does not need malloc or
623 realloc to be redefined. */ 698 realloc to be redefined. */
624#if @GNULIB_MALLOC_POSIX@ 699#if @GNULIB_MALLOC_POSIX@
625# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \ 700# if @REPLACE_MALLOC_FOR_MALLOC_POSIX@ \
626 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) 701 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
627# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 702# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
628 || _GL_USE_STDLIB_ALLOC) 703 || _GL_USE_STDLIB_ALLOC)
@@ -630,21 +705,24 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
630# define malloc rpl_malloc 705# define malloc rpl_malloc
631# endif 706# endif
632_GL_FUNCDECL_RPL (malloc, void *, 707_GL_FUNCDECL_RPL (malloc, void *,
633 (size_t size) 708 (size_t size),
634 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 709 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
710 _GL_ATTRIBUTE_NODISCARD);
635_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 711_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
636# else 712# else
637# if __GNUC__ >= 11 713# if __GNUC__ >= 11 && !defined __clang__
638/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 714/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
639# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 715# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
640_GL_FUNCDECL_SYS (malloc, void *, 716_GL_FUNCDECL_SYS (malloc, void *,
641 (size_t size) 717 (size_t size),
642 _GL_ATTRIBUTE_NOTHROW 718 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
643 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 719 _GL_ATTRIBUTE_NODISCARD)
720 _GL_ATTRIBUTE_NOTHROW;
644# else 721# else
645_GL_FUNCDECL_SYS (malloc, void *, 722_GL_FUNCDECL_SYS (malloc, void *,
646 (size_t size) 723 (size_t size),
647 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 724 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
725 _GL_ATTRIBUTE_NODISCARD);
648# endif 726# endif
649# endif 727# endif
650_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 728_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
@@ -653,35 +731,41 @@ _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
653_GL_CXXALIASWARN (malloc); 731_GL_CXXALIASWARN (malloc);
654# endif 732# endif
655#else 733#else
656# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc 734# if @GNULIB_FREE_POSIX@ \
735 && (__GNUC__ >= 11 && !defined __clang__) && !defined malloc
657/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 736/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
658# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 737# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
659_GL_FUNCDECL_SYS (malloc, void *, 738_GL_FUNCDECL_SYS (malloc, void *,
660 (size_t size) 739 (size_t size),
661 _GL_ATTRIBUTE_NOTHROW 740 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
662 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 741 _GL_ATTRIBUTE_NOTHROW;
663# else 742# else
664_GL_FUNCDECL_SYS (malloc, void *, 743_GL_FUNCDECL_SYS (malloc, void *,
665 (size_t size) 744 (size_t size),
666 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 745 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
667# endif 746# endif
668# endif 747# endif
669# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 748# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
670# undef malloc
671/* Assume malloc is always declared. */ 749/* Assume malloc is always declared. */
672_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " 750_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
673 "use gnulib module malloc-posix for portability"); 751 "use gnulib module malloc-posix for portability");
674# endif 752# endif
675#endif 753#endif
676 754
677/* Return maximum number of bytes of a multibyte character. */ 755/* Return maximum number of bytes in a multibyte character in the
756 current locale. */
678#if @REPLACE_MB_CUR_MAX@ 757#if @REPLACE_MB_CUR_MAX@
679# if !GNULIB_defined_MB_CUR_MAX 758# if !GNULIB_defined_MB_CUR_MAX
680static inline 759_GL_STDLIB_INLINE size_t
681int gl_MB_CUR_MAX (void) 760gl_MB_CUR_MAX (void)
682{ 761{
762# if 0 < @REPLACE_MB_CUR_MAX@
763 return @REPLACE_MB_CUR_MAX@;
764# else
683 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ 765 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */
684 return MB_CUR_MAX + (MB_CUR_MAX == 3); 766 int gl_mb_cur_max = MB_CUR_MAX;
767 return gl_mb_cur_max == 3 ? 4 : gl_mb_cur_max;
768# endif
685} 769}
686# undef MB_CUR_MAX 770# undef MB_CUR_MAX
687# define MB_CUR_MAX gl_MB_CUR_MAX () 771# define MB_CUR_MAX gl_MB_CUR_MAX ()
@@ -698,7 +782,7 @@ int gl_MB_CUR_MAX (void)
698# endif 782# endif
699_GL_FUNCDECL_RPL (mbstowcs, size_t, 783_GL_FUNCDECL_RPL (mbstowcs, size_t,
700 (wchar_t *restrict dest, const char *restrict src, 784 (wchar_t *restrict dest, const char *restrict src,
701 size_t len) 785 size_t len),
702 _GL_ARG_NONNULL ((2))); 786 _GL_ARG_NONNULL ((2)));
703_GL_CXXALIAS_RPL (mbstowcs, size_t, 787_GL_CXXALIAS_RPL (mbstowcs, size_t,
704 (wchar_t *restrict dest, const char *restrict src, 788 (wchar_t *restrict dest, const char *restrict src,
@@ -712,7 +796,6 @@ _GL_CXXALIAS_SYS (mbstowcs, size_t,
712_GL_CXXALIASWARN (mbstowcs); 796_GL_CXXALIASWARN (mbstowcs);
713# endif 797# endif
714#elif defined GNULIB_POSIXCHECK 798#elif defined GNULIB_POSIXCHECK
715# undef mbstowcs
716# if HAVE_RAW_DECL_MBSTOWCS 799# if HAVE_RAW_DECL_MBSTOWCS
717_GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - " 800_GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
718 "use gnulib module mbstowcs for portability"); 801 "use gnulib module mbstowcs for portability");
@@ -727,13 +810,13 @@ _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
727# define mbtowc rpl_mbtowc 810# define mbtowc rpl_mbtowc
728# endif 811# endif
729_GL_FUNCDECL_RPL (mbtowc, int, 812_GL_FUNCDECL_RPL (mbtowc, int,
730 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 813 (wchar_t *restrict pwc, const char *restrict s, size_t n), );
731_GL_CXXALIAS_RPL (mbtowc, int, 814_GL_CXXALIAS_RPL (mbtowc, int,
732 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 815 (wchar_t *restrict pwc, const char *restrict s, size_t n));
733# else 816# else
734# if !@HAVE_MBTOWC@ 817# if !@HAVE_MBTOWC@
735_GL_FUNCDECL_SYS (mbtowc, int, 818_GL_FUNCDECL_SYS (mbtowc, int,
736 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 819 (wchar_t *restrict pwc, const char *restrict s, size_t n), );
737# endif 820# endif
738_GL_CXXALIAS_SYS (mbtowc, int, 821_GL_CXXALIAS_SYS (mbtowc, int,
739 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 822 (wchar_t *restrict pwc, const char *restrict s, size_t n));
@@ -742,7 +825,6 @@ _GL_CXXALIAS_SYS (mbtowc, int,
742_GL_CXXALIASWARN (mbtowc); 825_GL_CXXALIASWARN (mbtowc);
743# endif 826# endif
744#elif defined GNULIB_POSIXCHECK 827#elif defined GNULIB_POSIXCHECK
745# undef mbtowc
746# if HAVE_RAW_DECL_MBTOWC 828# if HAVE_RAW_DECL_MBTOWC
747_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " 829_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
748 "use gnulib module mbtowc for portability"); 830 "use gnulib module mbtowc for portability");
@@ -756,12 +838,13 @@ _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
756 Returns TEMPLATE, or a null pointer if it cannot get a unique name. 838 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
757 The directory is created mode 700. */ 839 The directory is created mode 700. */
758# if !@HAVE_MKDTEMP@ 840# if !@HAVE_MKDTEMP@
759_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); 841_GL_FUNCDECL_SYS (mkdtemp, char *,
842 (char * /*template*/),
843 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
760# endif 844# endif
761_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); 845_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
762_GL_CXXALIASWARN (mkdtemp); 846_GL_CXXALIASWARN (mkdtemp);
763#elif defined GNULIB_POSIXCHECK 847#elif defined GNULIB_POSIXCHECK
764# undef mkdtemp
765# if HAVE_RAW_DECL_MKDTEMP 848# if HAVE_RAW_DECL_MKDTEMP
766_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " 849_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
767 "use gnulib module mkdtemp for portability"); 850 "use gnulib module mkdtemp for portability");
@@ -786,13 +869,13 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
786# undef mkostemp 869# undef mkostemp
787# define mkostemp rpl_mkostemp 870# define mkostemp rpl_mkostemp
788# endif 871# endif
789_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/) 872_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/),
790 _GL_ARG_NONNULL ((1))); 873 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
791_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)); 874_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/));
792# else 875# else
793# if !@HAVE_MKOSTEMP@ 876# if !@HAVE_MKOSTEMP@
794_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) 877_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/),
795 _GL_ARG_NONNULL ((1))); 878 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
796# endif 879# endif
797_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); 880_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
798# endif 881# endif
@@ -800,7 +883,6 @@ _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
800_GL_CXXALIASWARN (mkostemp); 883_GL_CXXALIASWARN (mkostemp);
801# endif 884# endif
802#elif defined GNULIB_POSIXCHECK 885#elif defined GNULIB_POSIXCHECK
803# undef mkostemp
804# if HAVE_RAW_DECL_MKOSTEMP 886# if HAVE_RAW_DECL_MKOSTEMP
805_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " 887_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
806 "use gnulib module mkostemp for portability"); 888 "use gnulib module mkostemp for portability");
@@ -827,15 +909,15 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
827# define mkostemps rpl_mkostemps 909# define mkostemps rpl_mkostemps
828# endif 910# endif
829_GL_FUNCDECL_RPL (mkostemps, int, 911_GL_FUNCDECL_RPL (mkostemps, int,
830 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 912 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
831 _GL_ARG_NONNULL ((1))); 913 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
832_GL_CXXALIAS_RPL (mkostemps, int, 914_GL_CXXALIAS_RPL (mkostemps, int,
833 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 915 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
834# else 916# else
835# if !@HAVE_MKOSTEMPS@ 917# if !@HAVE_MKOSTEMPS@
836_GL_FUNCDECL_SYS (mkostemps, int, 918_GL_FUNCDECL_SYS (mkostemps, int,
837 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 919 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
838 _GL_ARG_NONNULL ((1))); 920 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
839# endif 921# endif
840_GL_CXXALIAS_SYS (mkostemps, int, 922_GL_CXXALIAS_SYS (mkostemps, int,
841 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 923 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
@@ -844,7 +926,6 @@ _GL_CXXALIAS_SYS (mkostemps, int,
844_GL_CXXALIASWARN (mkostemps); 926_GL_CXXALIASWARN (mkostemps);
845# endif 927# endif
846#elif defined GNULIB_POSIXCHECK 928#elif defined GNULIB_POSIXCHECK
847# undef mkostemps
848# if HAVE_RAW_DECL_MKOSTEMPS 929# if HAVE_RAW_DECL_MKOSTEMPS
849_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " 930_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
850 "use gnulib module mkostemps for portability"); 931 "use gnulib module mkostemps for portability");
@@ -865,17 +946,18 @@ _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
865# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 946# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
866# define mkstemp rpl_mkstemp 947# define mkstemp rpl_mkstemp
867# endif 948# endif
868_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 949_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/),
950 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
869_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); 951_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
870# else 952# else
871# if ! @HAVE_MKSTEMP@ 953# if ! @HAVE_MKSTEMP@
872_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 954_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/),
955 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
873# endif 956# endif
874_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); 957_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
875# endif 958# endif
876_GL_CXXALIASWARN (mkstemp); 959_GL_CXXALIASWARN (mkstemp);
877#elif defined GNULIB_POSIXCHECK 960#elif defined GNULIB_POSIXCHECK
878# undef mkstemp
879# if HAVE_RAW_DECL_MKSTEMP 961# if HAVE_RAW_DECL_MKSTEMP
880_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " 962_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
881 "use gnulib module mkstemp for portability"); 963 "use gnulib module mkstemp for portability");
@@ -894,13 +976,12 @@ _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
894 Returns the open file descriptor if successful, otherwise -1 and errno 976 Returns the open file descriptor if successful, otherwise -1 and errno
895 set. */ 977 set. */
896# if !@HAVE_MKSTEMPS@ 978# if !@HAVE_MKSTEMPS@
897_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) 979_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/),
898 _GL_ARG_NONNULL ((1))); 980 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
899# endif 981# endif
900_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); 982_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
901_GL_CXXALIASWARN (mkstemps); 983_GL_CXXALIASWARN (mkstemps);
902#elif defined GNULIB_POSIXCHECK 984#elif defined GNULIB_POSIXCHECK
903# undef mkstemps
904# if HAVE_RAW_DECL_MKSTEMPS 985# if HAVE_RAW_DECL_MKSTEMPS
905_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " 986_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
906 "use gnulib module mkstemps for portability"); 987 "use gnulib module mkstemps for portability");
@@ -931,8 +1012,8 @@ _GL_CXXALIASWARN (mktemp);
931# define posix_memalign rpl_posix_memalign 1012# define posix_memalign rpl_posix_memalign
932# endif 1013# endif
933_GL_FUNCDECL_RPL (posix_memalign, int, 1014_GL_FUNCDECL_RPL (posix_memalign, int,
934 (void **memptr, size_t alignment, size_t size) 1015 (void **memptr, size_t alignment, size_t size),
935 _GL_ARG_NONNULL ((1))); 1016 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
936_GL_CXXALIAS_RPL (posix_memalign, int, 1017_GL_CXXALIAS_RPL (posix_memalign, int,
937 (void **memptr, size_t alignment, size_t size)); 1018 (void **memptr, size_t alignment, size_t size));
938# else 1019# else
@@ -945,7 +1026,6 @@ _GL_CXXALIAS_SYS (posix_memalign, int,
945_GL_CXXALIASWARN (posix_memalign); 1026_GL_CXXALIASWARN (posix_memalign);
946# endif 1027# endif
947#elif defined GNULIB_POSIXCHECK 1028#elif defined GNULIB_POSIXCHECK
948# undef posix_memalign
949# if HAVE_RAW_DECL_POSIX_MEMALIGN 1029# if HAVE_RAW_DECL_POSIX_MEMALIGN
950_GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " 1030_GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
951 "use gnulib module posix_memalign for portability"); 1031 "use gnulib module posix_memalign for portability");
@@ -960,11 +1040,11 @@ _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
960# undef posix_openpt 1040# undef posix_openpt
961# define posix_openpt rpl_posix_openpt 1041# define posix_openpt rpl_posix_openpt
962# endif 1042# endif
963_GL_FUNCDECL_RPL (posix_openpt, int, (int flags)); 1043_GL_FUNCDECL_RPL (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
964_GL_CXXALIAS_RPL (posix_openpt, int, (int flags)); 1044_GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
965# else 1045# else
966# if !@HAVE_POSIX_OPENPT@ 1046# if !@HAVE_POSIX_OPENPT@
967_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); 1047_GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
968# endif 1048# endif
969_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); 1049_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
970# endif 1050# endif
@@ -972,7 +1052,6 @@ _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
972_GL_CXXALIASWARN (posix_openpt); 1052_GL_CXXALIASWARN (posix_openpt);
973# endif 1053# endif
974#elif defined GNULIB_POSIXCHECK 1054#elif defined GNULIB_POSIXCHECK
975# undef posix_openpt
976# if HAVE_RAW_DECL_POSIX_OPENPT 1055# if HAVE_RAW_DECL_POSIX_OPENPT
977_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " 1056_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
978 "use gnulib module posix_openpt for portability"); 1057 "use gnulib module posix_openpt for portability");
@@ -987,17 +1066,16 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
987# undef ptsname 1066# undef ptsname
988# define ptsname rpl_ptsname 1067# define ptsname rpl_ptsname
989# endif 1068# endif
990_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); 1069_GL_FUNCDECL_RPL (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
991_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); 1070_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
992# else 1071# else
993# if !@HAVE_PTSNAME@ 1072# if !@HAVE_PTSNAME@
994_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 1073_GL_FUNCDECL_SYS (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
995# endif 1074# endif
996_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 1075_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
997# endif 1076# endif
998_GL_CXXALIASWARN (ptsname); 1077_GL_CXXALIASWARN (ptsname);
999#elif defined GNULIB_POSIXCHECK 1078#elif defined GNULIB_POSIXCHECK
1000# undef ptsname
1001# if HAVE_RAW_DECL_PTSNAME 1079# if HAVE_RAW_DECL_PTSNAME
1002_GL_WARN_ON_USE (ptsname, "ptsname is not portable - " 1080_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
1003 "use gnulib module ptsname for portability"); 1081 "use gnulib module ptsname for portability");
@@ -1013,11 +1091,11 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
1013# undef ptsname_r 1091# undef ptsname_r
1014# define ptsname_r rpl_ptsname_r 1092# define ptsname_r rpl_ptsname_r
1015# endif 1093# endif
1016_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 1094_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)); 1095_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
1018# else 1096# else
1019# if !@HAVE_PTSNAME_R@ 1097# if !@HAVE_PTSNAME_R@
1020_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1098_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len), );
1021# endif 1099# endif
1022_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1100_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1023# endif 1101# endif
@@ -1026,7 +1104,6 @@ _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1026# endif 1104# endif
1027_GL_CXXALIASWARN (ptsname_r); 1105_GL_CXXALIASWARN (ptsname_r);
1028#elif defined GNULIB_POSIXCHECK 1106#elif defined GNULIB_POSIXCHECK
1029# undef ptsname_r
1030# if HAVE_RAW_DECL_PTSNAME_R 1107# if HAVE_RAW_DECL_PTSNAME_R
1031_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " 1108_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
1032 "use gnulib module ptsname_r for portability"); 1109 "use gnulib module ptsname_r for portability");
@@ -1039,7 +1116,7 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
1039# undef putenv 1116# undef putenv
1040# define putenv rpl_putenv 1117# define putenv rpl_putenv
1041# endif 1118# endif
1042_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 1119_GL_FUNCDECL_RPL (putenv, int, (char *string), _GL_ARG_NONNULL ((1)));
1043_GL_CXXALIAS_RPL (putenv, int, (char *string)); 1120_GL_CXXALIAS_RPL (putenv, int, (char *string));
1044# elif defined _WIN32 && !defined __CYGWIN__ 1121# elif defined _WIN32 && !defined __CYGWIN__
1045# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1122# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1098,7 +1175,9 @@ typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
1098# endif 1175# endif
1099_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1176_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1100 _gl_qsort_r_compar_fn compare, 1177 _gl_qsort_r_compar_fn compare,
1101 void *arg) _GL_ARG_NONNULL ((1, 4))); 1178 void *arg),
1179 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1180 _GL_ARG_NONNULL ((4)));
1102_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1181_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1103 _gl_qsort_r_compar_fn compare, 1182 _gl_qsort_r_compar_fn compare,
1104 void *arg)); 1183 void *arg));
@@ -1106,7 +1185,9 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1106# if !@HAVE_QSORT_R@ 1185# if !@HAVE_QSORT_R@
1107_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1186_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1108 _gl_qsort_r_compar_fn compare, 1187 _gl_qsort_r_compar_fn compare,
1109 void *arg) _GL_ARG_NONNULL ((1, 4))); 1188 void *arg),
1189 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1190 _GL_ARG_NONNULL ((4)));
1110# endif 1191# endif
1111_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1192_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1112 _gl_qsort_r_compar_fn compare, 1193 _gl_qsort_r_compar_fn compare,
@@ -1116,7 +1197,6 @@ _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1116_GL_CXXALIASWARN (qsort_r); 1197_GL_CXXALIASWARN (qsort_r);
1117# endif 1198# endif
1118#elif defined GNULIB_POSIXCHECK 1199#elif defined GNULIB_POSIXCHECK
1119# undef qsort_r
1120# if HAVE_RAW_DECL_QSORT_R 1200# if HAVE_RAW_DECL_QSORT_R
1121_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " 1201_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
1122 "use gnulib module qsort_r for portability"); 1202 "use gnulib module qsort_r for portability");
@@ -1137,7 +1217,7 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
1137# undef rand 1217# undef rand
1138# define rand rpl_rand 1218# define rand rpl_rand
1139# endif 1219# endif
1140_GL_FUNCDECL_RPL (rand, int, (void)); 1220_GL_FUNCDECL_RPL (rand, int, (void), );
1141_GL_CXXALIAS_RPL (rand, int, (void)); 1221_GL_CXXALIAS_RPL (rand, int, (void));
1142# else 1222# else
1143_GL_CXXALIAS_SYS (rand, int, (void)); 1223_GL_CXXALIAS_SYS (rand, int, (void));
@@ -1154,11 +1234,11 @@ _GL_CXXALIASWARN (rand);
1154# undef random 1234# undef random
1155# define random rpl_random 1235# define random rpl_random
1156# endif 1236# endif
1157_GL_FUNCDECL_RPL (random, long, (void)); 1237_GL_FUNCDECL_RPL (random, long, (void), );
1158_GL_CXXALIAS_RPL (random, long, (void)); 1238_GL_CXXALIAS_RPL (random, long, (void));
1159# else 1239# else
1160# if !@HAVE_RANDOM@ 1240# if !@HAVE_RANDOM@
1161_GL_FUNCDECL_SYS (random, long, (void)); 1241_GL_FUNCDECL_SYS (random, long, (void), );
1162# endif 1242# endif
1163/* Need to cast, because on Haiku, the return type is 1243/* Need to cast, because on Haiku, the return type is
1164 int. */ 1244 int. */
@@ -1168,7 +1248,6 @@ _GL_CXXALIAS_SYS_CAST (random, long, (void));
1168_GL_CXXALIASWARN (random); 1248_GL_CXXALIASWARN (random);
1169# endif 1249# endif
1170#elif defined GNULIB_POSIXCHECK 1250#elif defined GNULIB_POSIXCHECK
1171# undef random
1172# if HAVE_RAW_DECL_RANDOM 1251# if HAVE_RAW_DECL_RANDOM
1173_GL_WARN_ON_USE (random, "random is unportable - " 1252_GL_WARN_ON_USE (random, "random is unportable - "
1174 "use gnulib module random for portability"); 1253 "use gnulib module random for portability");
@@ -1181,11 +1260,11 @@ _GL_WARN_ON_USE (random, "random is unportable - "
1181# undef srandom 1260# undef srandom
1182# define srandom rpl_srandom 1261# define srandom rpl_srandom
1183# endif 1262# endif
1184_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); 1263_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed), );
1185_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); 1264_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
1186# else 1265# else
1187# if !@HAVE_RANDOM@ 1266# if !@HAVE_RANDOM@
1188_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 1267_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed), );
1189# endif 1268# endif
1190/* Need to cast, because on FreeBSD, the first parameter is 1269/* Need to cast, because on FreeBSD, the first parameter is
1191 unsigned long seed. */ 1270 unsigned long seed. */
@@ -1195,7 +1274,6 @@ _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
1195_GL_CXXALIASWARN (srandom); 1274_GL_CXXALIASWARN (srandom);
1196# endif 1275# endif
1197#elif defined GNULIB_POSIXCHECK 1276#elif defined GNULIB_POSIXCHECK
1198# undef srandom
1199# if HAVE_RAW_DECL_SRANDOM 1277# if HAVE_RAW_DECL_SRANDOM
1200_GL_WARN_ON_USE (srandom, "srandom is unportable - " 1278_GL_WARN_ON_USE (srandom, "srandom is unportable - "
1201 "use gnulib module random for portability"); 1279 "use gnulib module random for portability");
@@ -1209,14 +1287,14 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
1209# define initstate rpl_initstate 1287# define initstate rpl_initstate
1210# endif 1288# endif
1211_GL_FUNCDECL_RPL (initstate, char *, 1289_GL_FUNCDECL_RPL (initstate, char *,
1212 (unsigned int seed, char *buf, size_t buf_size) 1290 (unsigned int seed, char *buf, size_t buf_size),
1213 _GL_ARG_NONNULL ((2))); 1291 _GL_ARG_NONNULL ((2)));
1214_GL_CXXALIAS_RPL (initstate, char *, 1292_GL_CXXALIAS_RPL (initstate, char *,
1215 (unsigned int seed, char *buf, size_t buf_size)); 1293 (unsigned int seed, char *buf, size_t buf_size));
1216# else 1294# else
1217# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ 1295# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
1218_GL_FUNCDECL_SYS (initstate, char *, 1296_GL_FUNCDECL_SYS (initstate, char *,
1219 (unsigned int seed, char *buf, size_t buf_size) 1297 (unsigned int seed, char *buf, size_t buf_size),
1220 _GL_ARG_NONNULL ((2))); 1298 _GL_ARG_NONNULL ((2)));
1221# endif 1299# endif
1222/* Need to cast, because on FreeBSD, the first parameter is 1300/* Need to cast, because on FreeBSD, the first parameter is
@@ -1228,7 +1306,6 @@ _GL_CXXALIAS_SYS_CAST (initstate, char *,
1228_GL_CXXALIASWARN (initstate); 1306_GL_CXXALIASWARN (initstate);
1229# endif 1307# endif
1230#elif defined GNULIB_POSIXCHECK 1308#elif defined GNULIB_POSIXCHECK
1231# undef initstate
1232# if HAVE_RAW_DECL_INITSTATE 1309# if HAVE_RAW_DECL_INITSTATE
1233_GL_WARN_ON_USE (initstate, "initstate is unportable - " 1310_GL_WARN_ON_USE (initstate, "initstate is unportable - "
1234 "use gnulib module random for portability"); 1311 "use gnulib module random for portability");
@@ -1241,11 +1318,11 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - "
1241# undef setstate 1318# undef setstate
1242# define setstate rpl_setstate 1319# define setstate rpl_setstate
1243# endif 1320# endif
1244_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1321_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
1245_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); 1322_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
1246# else 1323# else
1247# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ 1324# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
1248_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1325_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
1249# endif 1326# endif
1250/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter 1327/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
1251 is const char *arg_state. */ 1328 is const char *arg_state. */
@@ -1255,7 +1332,6 @@ _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
1255_GL_CXXALIASWARN (setstate); 1332_GL_CXXALIASWARN (setstate);
1256# endif 1333# endif
1257#elif defined GNULIB_POSIXCHECK 1334#elif defined GNULIB_POSIXCHECK
1258# undef setstate
1259# if HAVE_RAW_DECL_SETSTATE 1335# if HAVE_RAW_DECL_SETSTATE
1260_GL_WARN_ON_USE (setstate, "setstate is unportable - " 1336_GL_WARN_ON_USE (setstate, "setstate is unportable - "
1261 "use gnulib module random for portability"); 1337 "use gnulib module random for portability");
@@ -1269,19 +1345,18 @@ _GL_WARN_ON_USE (setstate, "setstate is unportable - "
1269# undef random_r 1345# undef random_r
1270# define random_r rpl_random_r 1346# define random_r rpl_random_r
1271# endif 1347# endif
1272_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) 1348_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result),
1273 _GL_ARG_NONNULL ((1, 2))); 1349 _GL_ARG_NONNULL ((1, 2)));
1274_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); 1350_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1275# else 1351# else
1276# if !@HAVE_RANDOM_R@ 1352# if !@HAVE_RANDOM_R@
1277_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 1353_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result),
1278 _GL_ARG_NONNULL ((1, 2))); 1354 _GL_ARG_NONNULL ((1, 2)));
1279# endif 1355# endif
1280_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 1356_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
1281# endif 1357# endif
1282_GL_CXXALIASWARN (random_r); 1358_GL_CXXALIASWARN (random_r);
1283#elif defined GNULIB_POSIXCHECK 1359#elif defined GNULIB_POSIXCHECK
1284# undef random_r
1285# if HAVE_RAW_DECL_RANDOM_R 1360# if HAVE_RAW_DECL_RANDOM_R
1286_GL_WARN_ON_USE (random_r, "random_r is unportable - " 1361_GL_WARN_ON_USE (random_r, "random_r is unportable - "
1287 "use gnulib module random_r for portability"); 1362 "use gnulib module random_r for portability");
@@ -1295,14 +1370,14 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1295# define srandom_r rpl_srandom_r 1370# define srandom_r rpl_srandom_r
1296# endif 1371# endif
1297_GL_FUNCDECL_RPL (srandom_r, int, 1372_GL_FUNCDECL_RPL (srandom_r, int,
1298 (unsigned int seed, struct random_data *rand_state) 1373 (unsigned int seed, struct random_data *rand_state),
1299 _GL_ARG_NONNULL ((2))); 1374 _GL_ARG_NONNULL ((2)));
1300_GL_CXXALIAS_RPL (srandom_r, int, 1375_GL_CXXALIAS_RPL (srandom_r, int,
1301 (unsigned int seed, struct random_data *rand_state)); 1376 (unsigned int seed, struct random_data *rand_state));
1302# else 1377# else
1303# if !@HAVE_RANDOM_R@ 1378# if !@HAVE_RANDOM_R@
1304_GL_FUNCDECL_SYS (srandom_r, int, 1379_GL_FUNCDECL_SYS (srandom_r, int,
1305 (unsigned int seed, struct random_data *rand_state) 1380 (unsigned int seed, struct random_data *rand_state),
1306 _GL_ARG_NONNULL ((2))); 1381 _GL_ARG_NONNULL ((2)));
1307# endif 1382# endif
1308_GL_CXXALIAS_SYS (srandom_r, int, 1383_GL_CXXALIAS_SYS (srandom_r, int,
@@ -1310,7 +1385,6 @@ _GL_CXXALIAS_SYS (srandom_r, int,
1310# endif 1385# endif
1311_GL_CXXALIASWARN (srandom_r); 1386_GL_CXXALIASWARN (srandom_r);
1312#elif defined GNULIB_POSIXCHECK 1387#elif defined GNULIB_POSIXCHECK
1313# undef srandom_r
1314# if HAVE_RAW_DECL_SRANDOM_R 1388# if HAVE_RAW_DECL_SRANDOM_R
1315_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " 1389_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1316 "use gnulib module random_r for portability"); 1390 "use gnulib module random_r for portability");
@@ -1325,7 +1399,7 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1325# endif 1399# endif
1326_GL_FUNCDECL_RPL (initstate_r, int, 1400_GL_FUNCDECL_RPL (initstate_r, int,
1327 (unsigned int seed, char *buf, size_t buf_size, 1401 (unsigned int seed, char *buf, size_t buf_size,
1328 struct random_data *rand_state) 1402 struct random_data *rand_state),
1329 _GL_ARG_NONNULL ((2, 4))); 1403 _GL_ARG_NONNULL ((2, 4)));
1330_GL_CXXALIAS_RPL (initstate_r, int, 1404_GL_CXXALIAS_RPL (initstate_r, int,
1331 (unsigned int seed, char *buf, size_t buf_size, 1405 (unsigned int seed, char *buf, size_t buf_size,
@@ -1334,7 +1408,7 @@ _GL_CXXALIAS_RPL (initstate_r, int,
1334# if !@HAVE_RANDOM_R@ 1408# if !@HAVE_RANDOM_R@
1335_GL_FUNCDECL_SYS (initstate_r, int, 1409_GL_FUNCDECL_SYS (initstate_r, int,
1336 (unsigned int seed, char *buf, size_t buf_size, 1410 (unsigned int seed, char *buf, size_t buf_size,
1337 struct random_data *rand_state) 1411 struct random_data *rand_state),
1338 _GL_ARG_NONNULL ((2, 4))); 1412 _GL_ARG_NONNULL ((2, 4)));
1339# endif 1413# endif
1340/* Need to cast, because on Haiku, the third parameter is 1414/* Need to cast, because on Haiku, the third parameter is
@@ -1345,7 +1419,6 @@ _GL_CXXALIAS_SYS_CAST (initstate_r, int,
1345# endif 1419# endif
1346_GL_CXXALIASWARN (initstate_r); 1420_GL_CXXALIASWARN (initstate_r);
1347#elif defined GNULIB_POSIXCHECK 1421#elif defined GNULIB_POSIXCHECK
1348# undef initstate_r
1349# if HAVE_RAW_DECL_INITSTATE_R 1422# if HAVE_RAW_DECL_INITSTATE_R
1350_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " 1423_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1351 "use gnulib module random_r for portability"); 1424 "use gnulib module random_r for portability");
@@ -1359,14 +1432,14 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1359# define setstate_r rpl_setstate_r 1432# define setstate_r rpl_setstate_r
1360# endif 1433# endif
1361_GL_FUNCDECL_RPL (setstate_r, int, 1434_GL_FUNCDECL_RPL (setstate_r, int,
1362 (char *arg_state, struct random_data *rand_state) 1435 (char *arg_state, struct random_data *rand_state),
1363 _GL_ARG_NONNULL ((1, 2))); 1436 _GL_ARG_NONNULL ((1, 2)));
1364_GL_CXXALIAS_RPL (setstate_r, int, 1437_GL_CXXALIAS_RPL (setstate_r, int,
1365 (char *arg_state, struct random_data *rand_state)); 1438 (char *arg_state, struct random_data *rand_state));
1366# else 1439# else
1367# if !@HAVE_RANDOM_R@ 1440# if !@HAVE_RANDOM_R@
1368_GL_FUNCDECL_SYS (setstate_r, int, 1441_GL_FUNCDECL_SYS (setstate_r, int,
1369 (char *arg_state, struct random_data *rand_state) 1442 (char *arg_state, struct random_data *rand_state),
1370 _GL_ARG_NONNULL ((1, 2))); 1443 _GL_ARG_NONNULL ((1, 2)));
1371# endif 1444# endif
1372/* Need to cast, because on Haiku, the first parameter is 1445/* Need to cast, because on Haiku, the first parameter is
@@ -1376,7 +1449,6 @@ _GL_CXXALIAS_SYS_CAST (setstate_r, int,
1376# endif 1449# endif
1377_GL_CXXALIASWARN (setstate_r); 1450_GL_CXXALIASWARN (setstate_r);
1378#elif defined GNULIB_POSIXCHECK 1451#elif defined GNULIB_POSIXCHECK
1379# undef setstate_r
1380# if HAVE_RAW_DECL_SETSTATE_R 1452# if HAVE_RAW_DECL_SETSTATE_R
1381_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " 1453_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1382 "use gnulib module random_r for portability"); 1454 "use gnulib module random_r for portability");
@@ -1385,28 +1457,44 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1385 1457
1386 1458
1387#if @GNULIB_REALLOC_POSIX@ 1459#if @GNULIB_REALLOC_POSIX@
1388# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \ 1460# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
1389 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@) 1461# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
1462# define _GL_INLINE_RPL_REALLOC 1
1463# ifdef __cplusplus
1464extern "C" {
1465# endif
1466_GL_REALLOC_INLINE void *
1467rpl_realloc (void *ptr, size_t size)
1468{
1469 return realloc (ptr, size ? size : 1);
1470}
1471# ifdef __cplusplus
1472}
1473# endif
1474# endif
1390# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 1475# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1391 || _GL_USE_STDLIB_ALLOC) 1476 || _GL_USE_STDLIB_ALLOC)
1392# undef realloc 1477# undef realloc
1393# define realloc rpl_realloc 1478# define realloc rpl_realloc
1394# endif 1479# endif
1395_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) 1480# if !defined _GL_INLINE_RPL_REALLOC
1396 _GL_ATTRIBUTE_DEALLOC_FREE); 1481_GL_FUNCDECL_RPL (realloc, void *,
1482 (void *ptr, size_t size),
1483 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1484# endif
1397_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 1485_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1398# else 1486# else
1399# if __GNUC__ >= 11 1487# if __GNUC__ >= 11 && !defined __clang__
1400/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1488/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1401# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 1489# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1402_GL_FUNCDECL_SYS (realloc, void *, 1490_GL_FUNCDECL_SYS (realloc, void *,
1403 (void *ptr, size_t size) 1491 (void *ptr, size_t size),
1404 _GL_ATTRIBUTE_NOTHROW 1492 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD)
1405 _GL_ATTRIBUTE_DEALLOC_FREE); 1493 _GL_ATTRIBUTE_NOTHROW;
1406# else 1494# else
1407_GL_FUNCDECL_SYS (realloc, void *, 1495_GL_FUNCDECL_SYS (realloc, void *,
1408 (void *ptr, size_t size) 1496 (void *ptr, size_t size),
1409 _GL_ATTRIBUTE_DEALLOC_FREE); 1497 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1410# endif 1498# endif
1411# endif 1499# endif
1412_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 1500_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
@@ -1415,21 +1503,21 @@ _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1415_GL_CXXALIASWARN (realloc); 1503_GL_CXXALIASWARN (realloc);
1416# endif 1504# endif
1417#else 1505#else
1418# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc 1506# if @GNULIB_FREE_POSIX@ \
1507 && (__GNUC__ >= 11 && !defined __clang__) && !defined realloc
1419/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1508/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1420# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 1509# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1421_GL_FUNCDECL_SYS (realloc, void *, 1510_GL_FUNCDECL_SYS (realloc, void *,
1422 (void *ptr, size_t size) 1511 (void *ptr, size_t size),
1423 _GL_ATTRIBUTE_NOTHROW 1512 _GL_ATTRIBUTE_DEALLOC_FREE)
1424 _GL_ATTRIBUTE_DEALLOC_FREE); 1513 _GL_ATTRIBUTE_NOTHROW;
1425# else 1514# else
1426_GL_FUNCDECL_SYS (realloc, void *, 1515_GL_FUNCDECL_SYS (realloc, void *,
1427 (void *ptr, size_t size) 1516 (void *ptr, size_t size),
1428 _GL_ATTRIBUTE_DEALLOC_FREE); 1517 _GL_ATTRIBUTE_DEALLOC_FREE);
1429# endif 1518# endif
1430# endif 1519# endif
1431# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 1520# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1432# undef realloc
1433/* Assume realloc is always declared. */ 1521/* Assume realloc is always declared. */
1434_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " 1522_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1435 "use gnulib module realloc-posix for portability"); 1523 "use gnulib module realloc-posix for portability");
@@ -1444,13 +1532,15 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1444# define reallocarray rpl_reallocarray 1532# define reallocarray rpl_reallocarray
1445# endif 1533# endif
1446_GL_FUNCDECL_RPL (reallocarray, void *, 1534_GL_FUNCDECL_RPL (reallocarray, void *,
1447 (void *ptr, size_t nmemb, size_t size)); 1535 (void *ptr, size_t nmemb, size_t size),
1536 _GL_ATTRIBUTE_NODISCARD);
1448_GL_CXXALIAS_RPL (reallocarray, void *, 1537_GL_CXXALIAS_RPL (reallocarray, void *,
1449 (void *ptr, size_t nmemb, size_t size)); 1538 (void *ptr, size_t nmemb, size_t size));
1450# else 1539# else
1451# if ! @HAVE_REALLOCARRAY@ 1540# if ! @HAVE_REALLOCARRAY@
1452_GL_FUNCDECL_SYS (reallocarray, void *, 1541_GL_FUNCDECL_SYS (reallocarray, void *,
1453 (void *ptr, size_t nmemb, size_t size)); 1542 (void *ptr, size_t nmemb, size_t size),
1543 _GL_ATTRIBUTE_NODISCARD);
1454# endif 1544# endif
1455_GL_CXXALIAS_SYS (reallocarray, void *, 1545_GL_CXXALIAS_SYS (reallocarray, void *,
1456 (void *ptr, size_t nmemb, size_t size)); 1546 (void *ptr, size_t nmemb, size_t size));
@@ -1459,7 +1549,6 @@ _GL_CXXALIAS_SYS (reallocarray, void *,
1459_GL_CXXALIASWARN (reallocarray); 1549_GL_CXXALIASWARN (reallocarray);
1460# endif 1550# endif
1461#elif defined GNULIB_POSIXCHECK 1551#elif defined GNULIB_POSIXCHECK
1462# undef reallocarray
1463# if HAVE_RAW_DECL_REALLOCARRAY 1552# if HAVE_RAW_DECL_REALLOCARRAY
1464_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " 1553_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1465 "use gnulib module reallocarray for portability"); 1554 "use gnulib module reallocarray for portability");
@@ -1472,22 +1561,21 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1472# define realpath rpl_realpath 1561# define realpath rpl_realpath
1473# endif 1562# endif
1474_GL_FUNCDECL_RPL (realpath, char *, 1563_GL_FUNCDECL_RPL (realpath, char *,
1475 (const char *restrict name, char *restrict resolved) 1564 (const char *restrict name, char *restrict resolved),
1476 _GL_ARG_NONNULL ((1))); 1565 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1477_GL_CXXALIAS_RPL (realpath, char *, 1566_GL_CXXALIAS_RPL (realpath, char *,
1478 (const char *restrict name, char *restrict resolved)); 1567 (const char *restrict name, char *restrict resolved));
1479# else 1568# else
1480# if !@HAVE_REALPATH@ 1569# if !@HAVE_REALPATH@
1481_GL_FUNCDECL_SYS (realpath, char *, 1570_GL_FUNCDECL_SYS (realpath, char *,
1482 (const char *restrict name, char *restrict resolved) 1571 (const char *restrict name, char *restrict resolved),
1483 _GL_ARG_NONNULL ((1))); 1572 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1484# endif 1573# endif
1485_GL_CXXALIAS_SYS (realpath, char *, 1574_GL_CXXALIAS_SYS (realpath, char *,
1486 (const char *restrict name, char *restrict resolved)); 1575 (const char *restrict name, char *restrict resolved));
1487# endif 1576# endif
1488_GL_CXXALIASWARN (realpath); 1577_GL_CXXALIASWARN (realpath);
1489#elif defined GNULIB_POSIXCHECK 1578#elif defined GNULIB_POSIXCHECK
1490# undef realpath
1491# if HAVE_RAW_DECL_REALPATH 1579# if HAVE_RAW_DECL_REALPATH
1492_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " 1580_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1493 "canonicalize or canonicalize-lgpl for portability"); 1581 "canonicalize or canonicalize-lgpl for portability");
@@ -1498,12 +1586,12 @@ _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1498/* Test a user response to a question. 1586/* Test a user response to a question.
1499 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ 1587 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1500# if !@HAVE_RPMATCH@ 1588# if !@HAVE_RPMATCH@
1501_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); 1589_GL_FUNCDECL_SYS (rpmatch, int, (const char *response),
1590 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1502# endif 1591# endif
1503_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); 1592_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1504_GL_CXXALIASWARN (rpmatch); 1593_GL_CXXALIASWARN (rpmatch);
1505#elif defined GNULIB_POSIXCHECK 1594#elif defined GNULIB_POSIXCHECK
1506# undef rpmatch
1507# if HAVE_RAW_DECL_RPMATCH 1595# if HAVE_RAW_DECL_RPMATCH
1508_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " 1596_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1509 "use gnulib module rpmatch for portability"); 1597 "use gnulib module rpmatch for portability");
@@ -1514,12 +1602,12 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1514/* Look up NAME in the environment, returning 0 in insecure situations. */ 1602/* Look up NAME in the environment, returning 0 in insecure situations. */
1515# if !@HAVE_SECURE_GETENV@ 1603# if !@HAVE_SECURE_GETENV@
1516_GL_FUNCDECL_SYS (secure_getenv, char *, 1604_GL_FUNCDECL_SYS (secure_getenv, char *,
1517 (char const *name) _GL_ARG_NONNULL ((1))); 1605 (char const *name),
1606 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1518# endif 1607# endif
1519_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); 1608_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1520_GL_CXXALIASWARN (secure_getenv); 1609_GL_CXXALIASWARN (secure_getenv);
1521#elif defined GNULIB_POSIXCHECK 1610#elif defined GNULIB_POSIXCHECK
1522# undef secure_getenv
1523# if HAVE_RAW_DECL_SECURE_GETENV 1611# if HAVE_RAW_DECL_SECURE_GETENV
1524_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " 1612_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1525 "use gnulib module secure_getenv for portability"); 1613 "use gnulib module secure_getenv for portability");
@@ -1535,14 +1623,14 @@ _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1535# define setenv rpl_setenv 1623# define setenv rpl_setenv
1536# endif 1624# endif
1537_GL_FUNCDECL_RPL (setenv, int, 1625_GL_FUNCDECL_RPL (setenv, int,
1538 (const char *name, const char *value, int replace) 1626 (const char *name, const char *value, int replace),
1539 _GL_ARG_NONNULL ((1))); 1627 _GL_ARG_NONNULL ((1)));
1540_GL_CXXALIAS_RPL (setenv, int, 1628_GL_CXXALIAS_RPL (setenv, int,
1541 (const char *name, const char *value, int replace)); 1629 (const char *name, const char *value, int replace));
1542# else 1630# else
1543# if !@HAVE_DECL_SETENV@ 1631# if !@HAVE_DECL_SETENV@
1544_GL_FUNCDECL_SYS (setenv, int, 1632_GL_FUNCDECL_SYS (setenv, int,
1545 (const char *name, const char *value, int replace) 1633 (const char *name, const char *value, int replace),
1546 _GL_ARG_NONNULL ((1))); 1634 _GL_ARG_NONNULL ((1)));
1547# endif 1635# endif
1548_GL_CXXALIAS_SYS (setenv, int, 1636_GL_CXXALIAS_SYS (setenv, int,
@@ -1552,13 +1640,25 @@ _GL_CXXALIAS_SYS (setenv, int,
1552_GL_CXXALIASWARN (setenv); 1640_GL_CXXALIASWARN (setenv);
1553# endif 1641# endif
1554#elif defined GNULIB_POSIXCHECK 1642#elif defined GNULIB_POSIXCHECK
1555# undef setenv
1556# if HAVE_RAW_DECL_SETENV 1643# if HAVE_RAW_DECL_SETENV
1557_GL_WARN_ON_USE (setenv, "setenv is unportable - " 1644_GL_WARN_ON_USE (setenv, "setenv is unportable - "
1558 "use gnulib module setenv for portability"); 1645 "use gnulib module setenv for portability");
1559# endif 1646# endif
1560#endif 1647#endif
1561 1648
1649#if @GNULIB_STACK_TRACE@
1650/* Prints a stack trace of the current thread to standard error,
1651 if possible. */
1652# if @CAN_PRINT_STACK_TRACE@
1653_GL_EXTERN_C void print_stack_trace (void);
1654# else
1655# if !GNULIB_defined_print_stack_trace
1656# define print_stack_trace() /* nothing */
1657# define GNULIB_defined_print_stack_trace 1
1658# endif
1659# endif
1660#endif
1661
1562#if @GNULIB_STRTOD@ 1662#if @GNULIB_STRTOD@
1563 /* Parse a double from STRING, updating ENDP if appropriate. */ 1663 /* Parse a double from STRING, updating ENDP if appropriate. */
1564# if @REPLACE_STRTOD@ 1664# if @REPLACE_STRTOD@
@@ -1567,14 +1667,14 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1567# endif 1667# endif
1568# define GNULIB_defined_strtod_function 1 1668# define GNULIB_defined_strtod_function 1
1569_GL_FUNCDECL_RPL (strtod, double, 1669_GL_FUNCDECL_RPL (strtod, double,
1570 (const char *restrict str, char **restrict endp) 1670 (const char *restrict str, char **restrict endp),
1571 _GL_ARG_NONNULL ((1))); 1671 _GL_ARG_NONNULL ((1)));
1572_GL_CXXALIAS_RPL (strtod, double, 1672_GL_CXXALIAS_RPL (strtod, double,
1573 (const char *restrict str, char **restrict endp)); 1673 (const char *restrict str, char **restrict endp));
1574# else 1674# else
1575# if !@HAVE_STRTOD@ 1675# if !@HAVE_STRTOD@
1576_GL_FUNCDECL_SYS (strtod, double, 1676_GL_FUNCDECL_SYS (strtod, double,
1577 (const char *restrict str, char **restrict endp) 1677 (const char *restrict str, char **restrict endp),
1578 _GL_ARG_NONNULL ((1))); 1678 _GL_ARG_NONNULL ((1)));
1579# endif 1679# endif
1580_GL_CXXALIAS_SYS (strtod, double, 1680_GL_CXXALIAS_SYS (strtod, double,
@@ -1584,7 +1684,6 @@ _GL_CXXALIAS_SYS (strtod, double,
1584_GL_CXXALIASWARN (strtod); 1684_GL_CXXALIASWARN (strtod);
1585# endif 1685# endif
1586#elif defined GNULIB_POSIXCHECK 1686#elif defined GNULIB_POSIXCHECK
1587# undef strtod
1588# if HAVE_RAW_DECL_STRTOD 1687# if HAVE_RAW_DECL_STRTOD
1589_GL_WARN_ON_USE (strtod, "strtod is unportable - " 1688_GL_WARN_ON_USE (strtod, "strtod is unportable - "
1590 "use gnulib module strtod for portability"); 1689 "use gnulib module strtod for portability");
@@ -1599,14 +1698,14 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1599# endif 1698# endif
1600# define GNULIB_defined_strtof_function 1 1699# define GNULIB_defined_strtof_function 1
1601_GL_FUNCDECL_RPL (strtof, float, 1700_GL_FUNCDECL_RPL (strtof, float,
1602 (const char *restrict str, char **restrict endp) 1701 (const char *restrict str, char **restrict endp),
1603 _GL_ARG_NONNULL ((1))); 1702 _GL_ARG_NONNULL ((1)));
1604_GL_CXXALIAS_RPL (strtof, float, 1703_GL_CXXALIAS_RPL (strtof, float,
1605 (const char *restrict str, char **restrict endp)); 1704 (const char *restrict str, char **restrict endp));
1606# else 1705# else
1607# if !@HAVE_STRTOF@ 1706# if !@HAVE_STRTOF@
1608_GL_FUNCDECL_SYS (strtof, float, 1707_GL_FUNCDECL_SYS (strtof, float,
1609 (const char *restrict str, char **restrict endp) 1708 (const char *restrict str, char **restrict endp),
1610 _GL_ARG_NONNULL ((1))); 1709 _GL_ARG_NONNULL ((1)));
1611# endif 1710# endif
1612_GL_CXXALIAS_SYS (strtof, float, 1711_GL_CXXALIAS_SYS (strtof, float,
@@ -1616,7 +1715,6 @@ _GL_CXXALIAS_SYS (strtof, float,
1616_GL_CXXALIASWARN (strtof); 1715_GL_CXXALIASWARN (strtof);
1617# endif 1716# endif
1618#elif defined GNULIB_POSIXCHECK 1717#elif defined GNULIB_POSIXCHECK
1619# undef strtof
1620# if HAVE_RAW_DECL_STRTOF 1718# if HAVE_RAW_DECL_STRTOF
1621_GL_WARN_ON_USE (strtof, "strtof is unportable - " 1719_GL_WARN_ON_USE (strtof, "strtof is unportable - "
1622 "use gnulib module strtof for portability"); 1720 "use gnulib module strtof for portability");
@@ -1631,14 +1729,14 @@ _GL_WARN_ON_USE (strtof, "strtof is unportable - "
1631# endif 1729# endif
1632# define GNULIB_defined_strtold_function 1 1730# define GNULIB_defined_strtold_function 1
1633_GL_FUNCDECL_RPL (strtold, long double, 1731_GL_FUNCDECL_RPL (strtold, long double,
1634 (const char *restrict str, char **restrict endp) 1732 (const char *restrict str, char **restrict endp),
1635 _GL_ARG_NONNULL ((1))); 1733 _GL_ARG_NONNULL ((1)));
1636_GL_CXXALIAS_RPL (strtold, long double, 1734_GL_CXXALIAS_RPL (strtold, long double,
1637 (const char *restrict str, char **restrict endp)); 1735 (const char *restrict str, char **restrict endp));
1638# else 1736# else
1639# if !@HAVE_STRTOLD@ 1737# if !@HAVE_STRTOLD@
1640_GL_FUNCDECL_SYS (strtold, long double, 1738_GL_FUNCDECL_SYS (strtold, long double,
1641 (const char *restrict str, char **restrict endp) 1739 (const char *restrict str, char **restrict endp),
1642 _GL_ARG_NONNULL ((1))); 1740 _GL_ARG_NONNULL ((1)));
1643# endif 1741# endif
1644_GL_CXXALIAS_SYS (strtold, long double, 1742_GL_CXXALIAS_SYS (strtold, long double,
@@ -1646,7 +1744,6 @@ _GL_CXXALIAS_SYS (strtold, long double,
1646# endif 1744# endif
1647_GL_CXXALIASWARN (strtold); 1745_GL_CXXALIASWARN (strtold);
1648#elif defined GNULIB_POSIXCHECK 1746#elif defined GNULIB_POSIXCHECK
1649# undef strtold
1650# if HAVE_RAW_DECL_STRTOLD 1747# if HAVE_RAW_DECL_STRTOLD
1651_GL_WARN_ON_USE (strtold, "strtold is unportable - " 1748_GL_WARN_ON_USE (strtold, "strtold is unportable - "
1652 "use gnulib module strtold for portability"); 1749 "use gnulib module strtold for portability");
@@ -1669,7 +1766,7 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1669# define GNULIB_defined_strtol_function 1 1766# define GNULIB_defined_strtol_function 1
1670_GL_FUNCDECL_RPL (strtol, long, 1767_GL_FUNCDECL_RPL (strtol, long,
1671 (const char *restrict string, char **restrict endptr, 1768 (const char *restrict string, char **restrict endptr,
1672 int base) 1769 int base),
1673 _GL_ARG_NONNULL ((1))); 1770 _GL_ARG_NONNULL ((1)));
1674_GL_CXXALIAS_RPL (strtol, long, 1771_GL_CXXALIAS_RPL (strtol, long,
1675 (const char *restrict string, char **restrict endptr, 1772 (const char *restrict string, char **restrict endptr,
@@ -1678,7 +1775,7 @@ _GL_CXXALIAS_RPL (strtol, long,
1678# if !@HAVE_STRTOL@ 1775# if !@HAVE_STRTOL@
1679_GL_FUNCDECL_SYS (strtol, long, 1776_GL_FUNCDECL_SYS (strtol, long,
1680 (const char *restrict string, char **restrict endptr, 1777 (const char *restrict string, char **restrict endptr,
1681 int base) 1778 int base),
1682 _GL_ARG_NONNULL ((1))); 1779 _GL_ARG_NONNULL ((1)));
1683# endif 1780# endif
1684_GL_CXXALIAS_SYS (strtol, long, 1781_GL_CXXALIAS_SYS (strtol, long,
@@ -1689,7 +1786,6 @@ _GL_CXXALIAS_SYS (strtol, long,
1689_GL_CXXALIASWARN (strtol); 1786_GL_CXXALIASWARN (strtol);
1690# endif 1787# endif
1691#elif defined GNULIB_POSIXCHECK 1788#elif defined GNULIB_POSIXCHECK
1692# undef strtol
1693# if HAVE_RAW_DECL_STRTOL 1789# if HAVE_RAW_DECL_STRTOL
1694_GL_WARN_ON_USE (strtol, "strtol is unportable - " 1790_GL_WARN_ON_USE (strtol, "strtol is unportable - "
1695 "use gnulib module strtol for portability"); 1791 "use gnulib module strtol for portability");
@@ -1712,7 +1808,7 @@ _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1712# define GNULIB_defined_strtoll_function 1 1808# define GNULIB_defined_strtoll_function 1
1713_GL_FUNCDECL_RPL (strtoll, long long, 1809_GL_FUNCDECL_RPL (strtoll, long long,
1714 (const char *restrict string, char **restrict endptr, 1810 (const char *restrict string, char **restrict endptr,
1715 int base) 1811 int base),
1716 _GL_ARG_NONNULL ((1))); 1812 _GL_ARG_NONNULL ((1)));
1717_GL_CXXALIAS_RPL (strtoll, long long, 1813_GL_CXXALIAS_RPL (strtoll, long long,
1718 (const char *restrict string, char **restrict endptr, 1814 (const char *restrict string, char **restrict endptr,
@@ -1721,7 +1817,7 @@ _GL_CXXALIAS_RPL (strtoll, long long,
1721# if !@HAVE_STRTOLL@ 1817# if !@HAVE_STRTOLL@
1722_GL_FUNCDECL_SYS (strtoll, long long, 1818_GL_FUNCDECL_SYS (strtoll, long long,
1723 (const char *restrict string, char **restrict endptr, 1819 (const char *restrict string, char **restrict endptr,
1724 int base) 1820 int base),
1725 _GL_ARG_NONNULL ((1))); 1821 _GL_ARG_NONNULL ((1)));
1726# endif 1822# endif
1727_GL_CXXALIAS_SYS (strtoll, long long, 1823_GL_CXXALIAS_SYS (strtoll, long long,
@@ -1730,7 +1826,6 @@ _GL_CXXALIAS_SYS (strtoll, long long,
1730# endif 1826# endif
1731_GL_CXXALIASWARN (strtoll); 1827_GL_CXXALIASWARN (strtoll);
1732#elif defined GNULIB_POSIXCHECK 1828#elif defined GNULIB_POSIXCHECK
1733# undef strtoll
1734# if HAVE_RAW_DECL_STRTOLL 1829# if HAVE_RAW_DECL_STRTOLL
1735_GL_WARN_ON_USE (strtoll, "strtoll is unportable - " 1830_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1736 "use gnulib module strtoll for portability"); 1831 "use gnulib module strtoll for portability");
@@ -1752,7 +1847,7 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1752# define GNULIB_defined_strtoul_function 1 1847# define GNULIB_defined_strtoul_function 1
1753_GL_FUNCDECL_RPL (strtoul, unsigned long, 1848_GL_FUNCDECL_RPL (strtoul, unsigned long,
1754 (const char *restrict string, char **restrict endptr, 1849 (const char *restrict string, char **restrict endptr,
1755 int base) 1850 int base),
1756 _GL_ARG_NONNULL ((1))); 1851 _GL_ARG_NONNULL ((1)));
1757_GL_CXXALIAS_RPL (strtoul, unsigned long, 1852_GL_CXXALIAS_RPL (strtoul, unsigned long,
1758 (const char *restrict string, char **restrict endptr, 1853 (const char *restrict string, char **restrict endptr,
@@ -1761,7 +1856,7 @@ _GL_CXXALIAS_RPL (strtoul, unsigned long,
1761# if !@HAVE_STRTOUL@ 1856# if !@HAVE_STRTOUL@
1762_GL_FUNCDECL_SYS (strtoul, unsigned long, 1857_GL_FUNCDECL_SYS (strtoul, unsigned long,
1763 (const char *restrict string, char **restrict endptr, 1858 (const char *restrict string, char **restrict endptr,
1764 int base) 1859 int base),
1765 _GL_ARG_NONNULL ((1))); 1860 _GL_ARG_NONNULL ((1)));
1766# endif 1861# endif
1767_GL_CXXALIAS_SYS (strtoul, unsigned long, 1862_GL_CXXALIAS_SYS (strtoul, unsigned long,
@@ -1772,7 +1867,6 @@ _GL_CXXALIAS_SYS (strtoul, unsigned long,
1772_GL_CXXALIASWARN (strtoul); 1867_GL_CXXALIASWARN (strtoul);
1773# endif 1868# endif
1774#elif defined GNULIB_POSIXCHECK 1869#elif defined GNULIB_POSIXCHECK
1775# undef strtoul
1776# if HAVE_RAW_DECL_STRTOUL 1870# if HAVE_RAW_DECL_STRTOUL
1777_GL_WARN_ON_USE (strtoul, "strtoul is unportable - " 1871_GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1778 "use gnulib module strtoul for portability"); 1872 "use gnulib module strtoul for portability");
@@ -1795,7 +1889,7 @@ _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1795# define GNULIB_defined_strtoull_function 1 1889# define GNULIB_defined_strtoull_function 1
1796_GL_FUNCDECL_RPL (strtoull, unsigned long long, 1890_GL_FUNCDECL_RPL (strtoull, unsigned long long,
1797 (const char *restrict string, char **restrict endptr, 1891 (const char *restrict string, char **restrict endptr,
1798 int base) 1892 int base),
1799 _GL_ARG_NONNULL ((1))); 1893 _GL_ARG_NONNULL ((1)));
1800_GL_CXXALIAS_RPL (strtoull, unsigned long long, 1894_GL_CXXALIAS_RPL (strtoull, unsigned long long,
1801 (const char *restrict string, char **restrict endptr, 1895 (const char *restrict string, char **restrict endptr,
@@ -1804,7 +1898,7 @@ _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1804# if !@HAVE_STRTOULL@ 1898# if !@HAVE_STRTOULL@
1805_GL_FUNCDECL_SYS (strtoull, unsigned long long, 1899_GL_FUNCDECL_SYS (strtoull, unsigned long long,
1806 (const char *restrict string, char **restrict endptr, 1900 (const char *restrict string, char **restrict endptr,
1807 int base) 1901 int base),
1808 _GL_ARG_NONNULL ((1))); 1902 _GL_ARG_NONNULL ((1)));
1809# endif 1903# endif
1810_GL_CXXALIAS_SYS (strtoull, unsigned long long, 1904_GL_CXXALIAS_SYS (strtoull, unsigned long long,
@@ -1813,7 +1907,6 @@ _GL_CXXALIAS_SYS (strtoull, unsigned long long,
1813# endif 1907# endif
1814_GL_CXXALIASWARN (strtoull); 1908_GL_CXXALIASWARN (strtoull);
1815#elif defined GNULIB_POSIXCHECK 1909#elif defined GNULIB_POSIXCHECK
1816# undef strtoull
1817# if HAVE_RAW_DECL_STRTOULL 1910# if HAVE_RAW_DECL_STRTOULL
1818_GL_WARN_ON_USE (strtoull, "strtoull is unportable - " 1911_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1819 "use gnulib module strtoull for portability"); 1912 "use gnulib module strtoull for portability");
@@ -1824,12 +1917,11 @@ _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1824/* Unlock the slave side of the pseudo-terminal whose master side is specified 1917/* Unlock the slave side of the pseudo-terminal whose master side is specified
1825 by FD, so that it can be opened. */ 1918 by FD, so that it can be opened. */
1826# if !@HAVE_UNLOCKPT@ 1919# if !@HAVE_UNLOCKPT@
1827_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); 1920_GL_FUNCDECL_SYS (unlockpt, int, (int fd), );
1828# endif 1921# endif
1829_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); 1922_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1830_GL_CXXALIASWARN (unlockpt); 1923_GL_CXXALIASWARN (unlockpt);
1831#elif defined GNULIB_POSIXCHECK 1924#elif defined GNULIB_POSIXCHECK
1832# undef unlockpt
1833# if HAVE_RAW_DECL_UNLOCKPT 1925# if HAVE_RAW_DECL_UNLOCKPT
1834_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " 1926_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1835 "use gnulib module unlockpt for portability"); 1927 "use gnulib module unlockpt for portability");
@@ -1843,11 +1935,11 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1843# undef unsetenv 1935# undef unsetenv
1844# define unsetenv rpl_unsetenv 1936# define unsetenv rpl_unsetenv
1845# endif 1937# endif
1846_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1938_GL_FUNCDECL_RPL (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1847_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 1939_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1848# else 1940# else
1849# if !@HAVE_DECL_UNSETENV@ 1941# if !@HAVE_DECL_UNSETENV@
1850_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1942_GL_FUNCDECL_SYS (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1851# endif 1943# endif
1852_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 1944_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1853# endif 1945# endif
@@ -1855,7 +1947,6 @@ _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1855_GL_CXXALIASWARN (unsetenv); 1947_GL_CXXALIASWARN (unsetenv);
1856# endif 1948# endif
1857#elif defined GNULIB_POSIXCHECK 1949#elif defined GNULIB_POSIXCHECK
1858# undef unsetenv
1859# if HAVE_RAW_DECL_UNSETENV 1950# if HAVE_RAW_DECL_UNSETENV
1860_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " 1951_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1861 "use gnulib module unsetenv for portability"); 1952 "use gnulib module unsetenv for portability");
@@ -1869,7 +1960,7 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1869# undef wctomb 1960# undef wctomb
1870# define wctomb rpl_wctomb 1961# define wctomb rpl_wctomb
1871# endif 1962# endif
1872_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); 1963_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc), );
1873_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); 1964_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1874# else 1965# else
1875_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 1966_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
@@ -1880,6 +1971,20 @@ _GL_CXXALIASWARN (wctomb);
1880#endif 1971#endif
1881 1972
1882 1973
1974_GL_INLINE_HEADER_END
1975
1976
1977/* Includes that provide only macros that don't need to be overridden.
1978 (Includes that are needed for type definitions and function declarations
1979 have their place above, before the function overrides.) */
1980
1981/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.
1982 glibc 2.41 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */
1983#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP)
1984# include <sys/wait.h>
1985#endif
1986
1987
1883#endif /* _@GUARD_PREFIX@_STDLIB_H */ 1988#endif /* _@GUARD_PREFIX@_STDLIB_H */
1884#endif /* _@GUARD_PREFIX@_STDLIB_H */ 1989#endif /* _@GUARD_PREFIX@_STDLIB_H */
1885#endif 1990#endif