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.h753
1 files changed, 611 insertions, 142 deletions
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index b79e5f70..1342db48 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <stdlib.h>. 1/* A GNU-like <stdlib.h>.
2 2
3 Copyright (C) 1995, 2001-2004, 2006-2023 Free Software Foundation, Inc. 3 Copyright (C) 1995, 2001-2004, 2006-2025 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -20,12 +20,27 @@
20#endif 20#endif
21@PRAGMA_COLUMNS@ 21@PRAGMA_COLUMNS@
22 22
23#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc 23#if ((defined __need_system_stdlib_h && !defined _GLIBCXX_STDLIB_H) \
24 || defined __need_malloc_and_calloc) \
25 && !defined __SUNPRO_CC
24/* Special invocation conventions inside some gnulib header files, 26/* Special invocation conventions inside some gnulib header files,
25 and inside some glibc header files, respectively. */ 27 and inside some glibc header files, respectively.
28 Do not recognize this special invocation convention when GCC's
29 c++/11/stdlib.h is being included or has been included. This is needed
30 to support the use of clang+llvm binaries on Ubuntu 22.04 with
31 CXX="$clangdir/bin/clang++ -I/usr/include/c++/11 \
32 -I/usr/include/x86_64-linux-gnu/c++/11
33 -L/usr/lib/gcc/x86_64-linux-gnu/11
34 -Wl,-rpath,$clangdir/lib"
35 because in this case /usr/include/c++/11/stdlib.h (which does not support
36 the convention) is seen before the gnulib-generated stdlib.h. */
26 37
27#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ 38#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
28 39
40/* Make sure that the macros that indicate the special invocation convention
41 get undefined. This is needed at least on CentOS 7. */
42#undef __need_malloc_and_calloc
43
29#else 44#else
30/* Normal invocation convention. */ 45/* Normal invocation convention. */
31 46
@@ -37,11 +52,19 @@
37#ifndef _@GUARD_PREFIX@_STDLIB_H 52#ifndef _@GUARD_PREFIX@_STDLIB_H
38#define _@GUARD_PREFIX@_STDLIB_H 53#define _@GUARD_PREFIX@_STDLIB_H
39 54
55/* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
56 _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE,
57 _GL_INLINE_HEADER_BEGIN, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
58#if !_GL_CONFIG_H_INCLUDED
59 #error "Please include config.h first."
60#endif
61
40/* NetBSD 5.0 mis-defines NULL. */ 62/* NetBSD 5.0 mis-defines NULL. */
41#include <stddef.h> 63#include <stddef.h>
42 64
43/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */ 65/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.
44#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS 66 glibc 2.41 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */
67#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP)
45# include <sys/wait.h> 68# include <sys/wait.h>
46#endif 69#endif
47 70
@@ -67,9 +90,7 @@
67# include <random.h> 90# include <random.h>
68# endif 91# endif
69 92
70# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ 93# include <stdint.h>
71# include <stdint.h>
72# endif
73 94
74# if !@HAVE_STRUCT_RANDOM_DATA@ 95# if !@HAVE_STRUCT_RANDOM_DATA@
75/* Define 'struct random_data'. 96/* Define 'struct random_data'.
@@ -99,11 +120,30 @@ struct random_data
99# include <unistd.h> 120# include <unistd.h>
100#endif 121#endif
101 122
123#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && (defined __sun || defined _AIX)
124/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
125 below, this may cause compilation errors later in the libstdc++ header files
126 (that are part of GCC), such as:
127 error: 'rpl_strtol' is not a member of 'std'
128 To avoid this, include the relevant header files here, before these symbols
129 get defined as macros. But do so only on Solaris 11 and AIX (where it is
130 needed), not on mingw (where it would cause other compilation errors). */
131# include <string>
132#endif
133
134_GL_INLINE_HEADER_BEGIN
135#ifndef _GL_STDLIB_INLINE
136# define _GL_STDLIB_INLINE _GL_INLINE
137#endif
138#ifndef _GL_REALLOC_INLINE
139# define _GL_REALLOC_INLINE _GL_INLINE
140#endif
141
102/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers 142/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
103 that can be freed by passing them as the Ith argument to the 143 that can be freed by passing them as the Ith argument to the
104 function F. */ 144 function F. */
105#ifndef _GL_ATTRIBUTE_DEALLOC 145#ifndef _GL_ATTRIBUTE_DEALLOC
106# if __GNUC__ >= 11 146# if __GNUC__ >= 11 && !defined __clang__
107# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 147# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
108# else 148# else
109# define _GL_ATTRIBUTE_DEALLOC(f, i) 149# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -128,6 +168,40 @@ struct random_data
128# endif 168# endif
129#endif 169#endif
130 170
171/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
172 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
173/* Applies to: functions. */
174#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
175# if __GNUC__ >= 15 && !defined __clang__
176# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
177 __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
178# else
179# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
180# endif
181#endif
182
183/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
184 */
185#ifndef _GL_ATTRIBUTE_NOTHROW
186# if defined __cplusplus
187# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
188# if __cplusplus >= 201103L
189# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
190# else
191# define _GL_ATTRIBUTE_NOTHROW throw ()
192# endif
193# else
194# define _GL_ATTRIBUTE_NOTHROW
195# endif
196# else
197# if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
198# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
199# else
200# define _GL_ATTRIBUTE_NOTHROW
201# endif
202# endif
203#endif
204
131/* The __attribute__ feature is available in gcc versions 2.5 and later. 205/* The __attribute__ feature is available in gcc versions 2.5 and later.
132 The attribute __pure__ was added in gcc 2.96. */ 206 The attribute __pure__ was added in gcc 2.96. */
133#ifndef _GL_ATTRIBUTE_PURE 207#ifndef _GL_ATTRIBUTE_PURE
@@ -161,14 +235,37 @@ struct random_data
161#endif 235#endif
162 236
163 237
238/* Declarations for ISO C N3322. */
239#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
240_GL_EXTERN_C void *bsearch (const void *__key,
241 const void *__base, size_t __nmemb, size_t __size,
242 int (*__compare) (const void *, const void *))
243 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5));
244_GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size,
245 int (*__compare) (const void *, const void *))
246 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ARG_NONNULL ((4));
247#endif
248
249
164#if @GNULIB__EXIT@ 250#if @GNULIB__EXIT@
165/* Terminate the current process with the given return code, without running 251/* Terminate the current process with the given return code, without running
166 the 'atexit' handlers. */ 252 the 'atexit' handlers. */
167# if !@HAVE__EXIT@ 253# if @REPLACE__EXIT@
168_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); 254# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
169# endif 255# undef _Exit
256# define _Exit rpl__Exit
257# endif
258_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status), );
259_GL_CXXALIAS_RPL (_Exit, void, (int status));
260# else
261# if !@HAVE__EXIT@
262_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status), );
263# endif
170_GL_CXXALIAS_SYS (_Exit, void, (int status)); 264_GL_CXXALIAS_SYS (_Exit, void, (int status));
265# endif
266# if __GLIBC__ >= 2
171_GL_CXXALIASWARN (_Exit); 267_GL_CXXALIASWARN (_Exit);
268# endif
172#elif defined GNULIB_POSIXCHECK 269#elif defined GNULIB_POSIXCHECK
173# undef _Exit 270# undef _Exit
174# if HAVE_RAW_DECL__EXIT 271# if HAVE_RAW_DECL__EXIT
@@ -178,6 +275,26 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
178#endif 275#endif
179 276
180 277
278#if @GNULIB_ABORT_DEBUG@
279/* Terminates the current process with signal SIGABRT.
280 Note: While the original abort() function is safe to call in signal handlers,
281 the overridden abort() function is not. */
282# if @REPLACE_ABORT@
283# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
284# undef abort
285# define abort rpl_abort
286# endif
287_GL_FUNCDECL_RPL (abort, _Noreturn void, (void), );
288_GL_CXXALIAS_RPL (abort, void, (void));
289# else
290_GL_CXXALIAS_SYS (abort, void, (void));
291# endif
292# if __GLIBC__ >= 2
293_GL_CXXALIASWARN (abort);
294# endif
295#endif
296
297
181#if @GNULIB_FREE_POSIX@ 298#if @GNULIB_FREE_POSIX@
182# if @REPLACE_FREE@ 299# if @REPLACE_FREE@
183# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 300# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -185,9 +302,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
185# define free rpl_free 302# define free rpl_free
186# endif 303# endif
187# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) 304# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
188_GL_FUNCDECL_RPL (free, void, (void *ptr) throw ()); 305_GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
189# else 306# else
190_GL_FUNCDECL_RPL (free, void, (void *ptr)); 307_GL_FUNCDECL_RPL (free, void, (void *ptr), );
191# endif 308# endif
192_GL_CXXALIAS_RPL (free, void, (void *ptr)); 309_GL_CXXALIAS_RPL (free, void, (void *ptr));
193# else 310# else
@@ -199,8 +316,8 @@ _GL_CXXALIASWARN (free);
199#elif defined GNULIB_POSIXCHECK 316#elif defined GNULIB_POSIXCHECK
200# undef free 317# undef free
201/* Assume free is always declared. */ 318/* Assume free is always declared. */
202_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " 319_GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - "
203 "use gnulib module free for portability"); 320 "use gnulib module free-posix for portability");
204#endif 321#endif
205 322
206 323
@@ -212,16 +329,26 @@ _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
212# define aligned_alloc rpl_aligned_alloc 329# define aligned_alloc rpl_aligned_alloc
213# endif 330# endif
214_GL_FUNCDECL_RPL (aligned_alloc, void *, 331_GL_FUNCDECL_RPL (aligned_alloc, void *,
215 (size_t alignment, size_t size) 332 (size_t alignment, size_t size),
216 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 333 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
334 _GL_ATTRIBUTE_NODISCARD);
217_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); 335_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
218# else 336# else
219# if @HAVE_ALIGNED_ALLOC@ 337# if @HAVE_ALIGNED_ALLOC@
220# if __GNUC__ >= 11 338# if __GNUC__ >= 11 && !defined __clang__
221/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 339/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
340# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
222_GL_FUNCDECL_SYS (aligned_alloc, void *, 341_GL_FUNCDECL_SYS (aligned_alloc, void *,
223 (size_t alignment, size_t size) 342 (size_t alignment, size_t size),
224 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 343 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
344 _GL_ATTRIBUTE_NODISCARD)
345 _GL_ATTRIBUTE_NOTHROW;
346# else
347_GL_FUNCDECL_SYS (aligned_alloc, void *,
348 (size_t alignment, size_t size),
349 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
350 _GL_ATTRIBUTE_NODISCARD);
351# endif
225# endif 352# endif
226_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); 353_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
227# endif 354# endif
@@ -230,11 +357,19 @@ _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
230_GL_CXXALIASWARN (aligned_alloc); 357_GL_CXXALIASWARN (aligned_alloc);
231# endif 358# endif
232#else 359#else
233# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc 360# if @GNULIB_FREE_POSIX@ \
361 && (__GNUC__ >= 11 && !defined __clang__) && !defined aligned_alloc
234/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 362/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
363# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
235_GL_FUNCDECL_SYS (aligned_alloc, void *, 364_GL_FUNCDECL_SYS (aligned_alloc, void *,
236 (size_t alignment, size_t size) 365 (size_t alignment, size_t size),
366 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
367 _GL_ATTRIBUTE_NOTHROW;
368# else
369_GL_FUNCDECL_SYS (aligned_alloc, void *,
370 (size_t alignment, size_t size),
237 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 371 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
372# endif
238# endif 373# endif
239# if defined GNULIB_POSIXCHECK 374# if defined GNULIB_POSIXCHECK
240# undef aligned_alloc 375# undef aligned_alloc
@@ -249,9 +384,10 @@ _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
249/* Parse a signed decimal integer. 384/* Parse a signed decimal integer.
250 Returns the value of the integer. Errors are not detected. */ 385 Returns the value of the integer. Errors are not detected. */
251# if !@HAVE_ATOLL@ 386# if !@HAVE_ATOLL@
252_GL_FUNCDECL_SYS (atoll, long long, (const char *string) 387_GL_FUNCDECL_SYS (atoll, long long,
253 _GL_ATTRIBUTE_PURE 388 (const char *string),
254 _GL_ARG_NONNULL ((1))); 389 _GL_ATTRIBUTE_PURE
390 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
255# endif 391# endif
256_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 392_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
257_GL_CXXALIASWARN (atoll); 393_GL_CXXALIASWARN (atoll);
@@ -264,22 +400,33 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
264#endif 400#endif
265 401
266#if @GNULIB_CALLOC_POSIX@ 402#if @GNULIB_CALLOC_POSIX@
267# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \ 403# if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \
268 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) 404 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
269# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 405# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
406 || _GL_USE_STDLIB_ALLOC)
270# undef calloc 407# undef calloc
271# define calloc rpl_calloc 408# define calloc rpl_calloc
272# endif 409# endif
273_GL_FUNCDECL_RPL (calloc, void *, 410_GL_FUNCDECL_RPL (calloc, void *,
274 (size_t nmemb, size_t size) 411 (size_t nmemb, size_t size),
275 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 412 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
413 _GL_ATTRIBUTE_NODISCARD);
276_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 414_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
277# else 415# else
278# if __GNUC__ >= 11 416# if __GNUC__ >= 11 && !defined __clang__
279/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 417/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
418# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
280_GL_FUNCDECL_SYS (calloc, void *, 419_GL_FUNCDECL_SYS (calloc, void *,
281 (size_t nmemb, size_t size) 420 (size_t nmemb, size_t size),
282 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 421 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
422 _GL_ATTRIBUTE_NODISCARD)
423 _GL_ATTRIBUTE_NOTHROW;
424# else
425_GL_FUNCDECL_SYS (calloc, void *,
426 (size_t nmemb, size_t size),
427 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
428 _GL_ATTRIBUTE_NODISCARD);
429# endif
283# endif 430# endif
284_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 431_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
285# endif 432# endif
@@ -287,11 +434,19 @@ _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
287_GL_CXXALIASWARN (calloc); 434_GL_CXXALIASWARN (calloc);
288# endif 435# endif
289#else 436#else
290# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc 437# if @GNULIB_FREE_POSIX@ \
438 && (__GNUC__ >= 11 && !defined __clang__) && !defined calloc
291/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 439/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
440# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
292_GL_FUNCDECL_SYS (calloc, void *, 441_GL_FUNCDECL_SYS (calloc, void *,
293 (size_t nmemb, size_t size) 442 (size_t nmemb, size_t size),
443 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
444 _GL_ATTRIBUTE_NOTHROW;
445# else
446_GL_FUNCDECL_SYS (calloc, void *,
447 (size_t nmemb, size_t size),
294 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 448 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
449# endif
295# endif 450# endif
296# if defined GNULIB_POSIXCHECK 451# if defined GNULIB_POSIXCHECK
297# undef calloc 452# undef calloc
@@ -307,16 +462,27 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
307# define canonicalize_file_name rpl_canonicalize_file_name 462# define canonicalize_file_name rpl_canonicalize_file_name
308# endif 463# endif
309_GL_FUNCDECL_RPL (canonicalize_file_name, char *, 464_GL_FUNCDECL_RPL (canonicalize_file_name, char *,
310 (const char *name) 465 (const char *name),
311 _GL_ARG_NONNULL ((1)) 466 _GL_ARG_NONNULL ((1))
312 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 467 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
468 _GL_ATTRIBUTE_NODISCARD);
313_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 469_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
314# else 470# else
315# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 471# if !@HAVE_CANONICALIZE_FILE_NAME@ || (__GNUC__ >= 11 && !defined __clang__)
472# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
316_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 473_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
317 (const char *name) 474 (const char *name),
318 _GL_ARG_NONNULL ((1)) 475 _GL_ARG_NONNULL ((1))
319 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 476 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
477 _GL_ATTRIBUTE_NODISCARD)
478 _GL_ATTRIBUTE_NOTHROW;
479# else
480_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
481 (const char *name),
482 _GL_ARG_NONNULL ((1))
483 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
484 _GL_ATTRIBUTE_NODISCARD);
485# endif
320# endif 486# endif
321_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 487_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
322# endif 488# endif
@@ -326,13 +492,22 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
326# endif 492# endif
327_GL_CXXALIASWARN (canonicalize_file_name); 493_GL_CXXALIASWARN (canonicalize_file_name);
328#else 494#else
329# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name 495# if @GNULIB_FREE_POSIX@ \
496 && (__GNUC__ >= 11 && !defined __clang__) && !defined canonicalize_file_name
330/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or 497/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
331 rpl_free. */ 498 rpl_free. */
499# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
500_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
501 (const char *name),
502 _GL_ARG_NONNULL ((1))
503 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
504 _GL_ATTRIBUTE_NOTHROW;
505# else
332_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 506_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
333 (const char *name) 507 (const char *name),
334 _GL_ARG_NONNULL ((1)) 508 _GL_ARG_NONNULL ((1))
335 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 509 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
510# endif
336# endif 511# endif
337# if defined GNULIB_POSIXCHECK 512# if defined GNULIB_POSIXCHECK
338# undef canonicalize_file_name 513# undef canonicalize_file_name
@@ -416,12 +591,24 @@ _GL_CXXALIASWARN (gcvt);
416 The three numbers are the load average of the last 1 minute, the last 5 591 The three numbers are the load average of the last 1 minute, the last 5
417 minutes, and the last 15 minutes, respectively. 592 minutes, and the last 15 minutes, respectively.
418 LOADAVG is an array of NELEM numbers. */ 593 LOADAVG is an array of NELEM numbers. */
419# if !@HAVE_DECL_GETLOADAVG@ 594# if @REPLACE_GETLOADAVG@
420_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) 595# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
596# undef getloadavg
597# define getloadavg rpl_getloadavg
598# endif
599_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem),
421 _GL_ARG_NONNULL ((1))); 600 _GL_ARG_NONNULL ((1)));
422# endif 601_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
602# else
603# if !@HAVE_DECL_GETLOADAVG@
604_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem),
605 _GL_ARG_NONNULL ((1)));
606# endif
423_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); 607_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
608# endif
609# if __GLIBC__ >= 2
424_GL_CXXALIASWARN (getloadavg); 610_GL_CXXALIASWARN (getloadavg);
611# endif
425#elif defined GNULIB_POSIXCHECK 612#elif defined GNULIB_POSIXCHECK
426# undef getloadavg 613# undef getloadavg
427# if HAVE_RAW_DECL_GETLOADAVG 614# if HAVE_RAW_DECL_GETLOADAVG
@@ -430,6 +617,41 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
430# endif 617# endif
431#endif 618#endif
432 619
620#if @GNULIB_GETPROGNAME@
621/* Return the base name of the executing program.
622 On native Windows this will usually end in ".exe" or ".EXE". */
623# if @REPLACE_GETPROGNAME@
624# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
625# undef getprogname
626# define getprogname rpl_getprogname
627# endif
628# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
629_GL_FUNCDECL_RPL (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
630# else
631_GL_FUNCDECL_RPL (getprogname, const char *, (void), );
632# endif
633_GL_CXXALIAS_RPL (getprogname, const char *, (void));
634# else
635# if !@HAVE_GETPROGNAME@
636# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
637_GL_FUNCDECL_SYS (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
638# else
639_GL_FUNCDECL_SYS (getprogname, const char *, (void), );
640# endif
641# endif
642_GL_CXXALIAS_SYS (getprogname, const char *, (void));
643# endif
644# if __GLIBC__ >= 2
645_GL_CXXALIASWARN (getprogname);
646# endif
647#elif defined GNULIB_POSIXCHECK
648# undef getprogname
649# if HAVE_RAW_DECL_GETPROGNAME
650_GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
651 "use gnulib module getprogname for portability");
652# endif
653#endif
654
433#if @GNULIB_GETSUBOPT@ 655#if @GNULIB_GETSUBOPT@
434/* Assuming *OPTIONP is a comma separated list of elements of the form 656/* Assuming *OPTIONP is a comma separated list of elements of the form
435 "token" or "token=value", getsubopt parses the first of these elements. 657 "token" or "token=value", getsubopt parses the first of these elements.
@@ -442,14 +664,28 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
442 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. 664 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
443 For more details see the POSIX specification. 665 For more details see the POSIX specification.
444 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ 666 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
445# if !@HAVE_GETSUBOPT@ 667# if @REPLACE_GETSUBOPT@
668# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
669# undef getsubopt
670# define getsubopt rpl_getsubopt
671# endif
672_GL_FUNCDECL_RPL (getsubopt, int,
673 (char **optionp, char *const *tokens, char **valuep),
674 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
675_GL_CXXALIAS_RPL (getsubopt, int,
676 (char **optionp, char *const *tokens, char **valuep));
677# else
678# if !@HAVE_GETSUBOPT@
446_GL_FUNCDECL_SYS (getsubopt, int, 679_GL_FUNCDECL_SYS (getsubopt, int,
447 (char **optionp, char *const *tokens, char **valuep) 680 (char **optionp, char *const *tokens, char **valuep),
448 _GL_ARG_NONNULL ((1, 2, 3))); 681 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
449# endif 682# endif
450_GL_CXXALIAS_SYS (getsubopt, int, 683_GL_CXXALIAS_SYS (getsubopt, int,
451 (char **optionp, char *const *tokens, char **valuep)); 684 (char **optionp, char *const *tokens, char **valuep));
685# endif
686# if __GLIBC__ >= 2
452_GL_CXXALIASWARN (getsubopt); 687_GL_CXXALIASWARN (getsubopt);
688# endif
453#elif defined GNULIB_POSIXCHECK 689#elif defined GNULIB_POSIXCHECK
454# undef getsubopt 690# undef getsubopt
455# if HAVE_RAW_DECL_GETSUBOPT 691# if HAVE_RAW_DECL_GETSUBOPT
@@ -462,7 +698,7 @@ _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
462/* Change the ownership and access permission of the slave side of the 698/* Change the ownership and access permission of the slave side of the
463 pseudo-terminal whose master side is specified by FD. */ 699 pseudo-terminal whose master side is specified by FD. */
464# if !@HAVE_GRANTPT@ 700# if !@HAVE_GRANTPT@
465_GL_FUNCDECL_SYS (grantpt, int, (int fd)); 701_GL_FUNCDECL_SYS (grantpt, int, (int fd), );
466# endif 702# endif
467_GL_CXXALIAS_SYS (grantpt, int, (int fd)); 703_GL_CXXALIAS_SYS (grantpt, int, (int fd));
468_GL_CXXALIASWARN (grantpt); 704_GL_CXXALIASWARN (grantpt);
@@ -479,7 +715,7 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
479 by never specifying a zero size), so it does not need malloc or 715 by never specifying a zero size), so it does not need malloc or
480 realloc to be redefined. */ 716 realloc to be redefined. */
481#if @GNULIB_MALLOC_POSIX@ 717#if @GNULIB_MALLOC_POSIX@
482# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \ 718# if @REPLACE_MALLOC_FOR_MALLOC_POSIX@ \
483 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) 719 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
484# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 720# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
485 || _GL_USE_STDLIB_ALLOC) 721 || _GL_USE_STDLIB_ALLOC)
@@ -487,15 +723,25 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
487# define malloc rpl_malloc 723# define malloc rpl_malloc
488# endif 724# endif
489_GL_FUNCDECL_RPL (malloc, void *, 725_GL_FUNCDECL_RPL (malloc, void *,
490 (size_t size) 726 (size_t size),
491 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 727 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
728 _GL_ATTRIBUTE_NODISCARD);
492_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 729_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
493# else 730# else
494# if __GNUC__ >= 11 731# if __GNUC__ >= 11 && !defined __clang__
495/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 732/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
733# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
496_GL_FUNCDECL_SYS (malloc, void *, 734_GL_FUNCDECL_SYS (malloc, void *,
497 (size_t size) 735 (size_t size),
498 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 736 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
737 _GL_ATTRIBUTE_NODISCARD)
738 _GL_ATTRIBUTE_NOTHROW;
739# else
740_GL_FUNCDECL_SYS (malloc, void *,
741 (size_t size),
742 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
743 _GL_ATTRIBUTE_NODISCARD);
744# endif
499# endif 745# endif
500_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 746_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
501# endif 747# endif
@@ -503,11 +749,19 @@ _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
503_GL_CXXALIASWARN (malloc); 749_GL_CXXALIASWARN (malloc);
504# endif 750# endif
505#else 751#else
506# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc 752# if @GNULIB_FREE_POSIX@ \
753 && (__GNUC__ >= 11 && !defined __clang__) && !defined malloc
507/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 754/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
755# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
756_GL_FUNCDECL_SYS (malloc, void *,
757 (size_t size),
758 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
759 _GL_ATTRIBUTE_NOTHROW;
760# else
508_GL_FUNCDECL_SYS (malloc, void *, 761_GL_FUNCDECL_SYS (malloc, void *,
509 (size_t size) 762 (size_t size),
510 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 763 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
764# endif
511# endif 765# endif
512# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 766# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
513# undef malloc 767# undef malloc
@@ -517,6 +771,57 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
517# endif 771# endif
518#endif 772#endif
519 773
774/* Return maximum number of bytes in a multibyte character in the
775 current locale. */
776#if @REPLACE_MB_CUR_MAX@
777# if !GNULIB_defined_MB_CUR_MAX
778_GL_STDLIB_INLINE size_t
779gl_MB_CUR_MAX (void)
780{
781# if 0 < @REPLACE_MB_CUR_MAX@
782 return @REPLACE_MB_CUR_MAX@;
783# else
784 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */
785 int gl_mb_cur_max = MB_CUR_MAX;
786 return gl_mb_cur_max == 3 ? 4 : gl_mb_cur_max;
787# endif
788}
789# undef MB_CUR_MAX
790# define MB_CUR_MAX gl_MB_CUR_MAX ()
791# define GNULIB_defined_MB_CUR_MAX 1
792# endif
793#endif
794
795/* Convert a string to a wide string. */
796#if @GNULIB_MBSTOWCS@
797# if @REPLACE_MBSTOWCS@
798# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
799# undef mbstowcs
800# define mbstowcs rpl_mbstowcs
801# endif
802_GL_FUNCDECL_RPL (mbstowcs, size_t,
803 (wchar_t *restrict dest, const char *restrict src,
804 size_t len),
805 _GL_ARG_NONNULL ((2)));
806_GL_CXXALIAS_RPL (mbstowcs, size_t,
807 (wchar_t *restrict dest, const char *restrict src,
808 size_t len));
809# else
810_GL_CXXALIAS_SYS (mbstowcs, size_t,
811 (wchar_t *restrict dest, const char *restrict src,
812 size_t len));
813# endif
814# if __GLIBC__ >= 2
815_GL_CXXALIASWARN (mbstowcs);
816# endif
817#elif defined GNULIB_POSIXCHECK
818# undef mbstowcs
819# if HAVE_RAW_DECL_MBSTOWCS
820_GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
821 "use gnulib module mbstowcs for portability");
822# endif
823#endif
824
520/* Convert a multibyte character to a wide character. */ 825/* Convert a multibyte character to a wide character. */
521#if @GNULIB_MBTOWC@ 826#if @GNULIB_MBTOWC@
522# if @REPLACE_MBTOWC@ 827# if @REPLACE_MBTOWC@
@@ -525,13 +830,13 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
525# define mbtowc rpl_mbtowc 830# define mbtowc rpl_mbtowc
526# endif 831# endif
527_GL_FUNCDECL_RPL (mbtowc, int, 832_GL_FUNCDECL_RPL (mbtowc, int,
528 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 833 (wchar_t *restrict pwc, const char *restrict s, size_t n), );
529_GL_CXXALIAS_RPL (mbtowc, int, 834_GL_CXXALIAS_RPL (mbtowc, int,
530 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 835 (wchar_t *restrict pwc, const char *restrict s, size_t n));
531# else 836# else
532# if !@HAVE_MBTOWC@ 837# if !@HAVE_MBTOWC@
533_GL_FUNCDECL_SYS (mbtowc, int, 838_GL_FUNCDECL_SYS (mbtowc, int,
534 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 839 (wchar_t *restrict pwc, const char *restrict s, size_t n), );
535# endif 840# endif
536_GL_CXXALIAS_SYS (mbtowc, int, 841_GL_CXXALIAS_SYS (mbtowc, int,
537 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 842 (wchar_t *restrict pwc, const char *restrict s, size_t n));
@@ -554,7 +859,9 @@ _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
554 Returns TEMPLATE, or a null pointer if it cannot get a unique name. 859 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
555 The directory is created mode 700. */ 860 The directory is created mode 700. */
556# if !@HAVE_MKDTEMP@ 861# if !@HAVE_MKDTEMP@
557_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); 862_GL_FUNCDECL_SYS (mkdtemp, char *,
863 (char * /*template*/),
864 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
558# endif 865# endif
559_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); 866_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
560_GL_CXXALIASWARN (mkdtemp); 867_GL_CXXALIASWARN (mkdtemp);
@@ -579,12 +886,24 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
579 implementation. 886 implementation.
580 Returns the open file descriptor if successful, otherwise -1 and errno 887 Returns the open file descriptor if successful, otherwise -1 and errno
581 set. */ 888 set. */
582# if !@HAVE_MKOSTEMP@ 889# if @REPLACE_MKOSTEMP@
583_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) 890# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
584 _GL_ARG_NONNULL ((1))); 891# undef mkostemp
585# endif 892# define mkostemp rpl_mkostemp
893# endif
894_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/),
895 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
896_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/));
897# else
898# if !@HAVE_MKOSTEMP@
899_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/),
900 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
901# endif
586_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); 902_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
903# endif
904# if __GLIBC__ >= 2
587_GL_CXXALIASWARN (mkostemp); 905_GL_CXXALIASWARN (mkostemp);
906# endif
588#elif defined GNULIB_POSIXCHECK 907#elif defined GNULIB_POSIXCHECK
589# undef mkostemp 908# undef mkostemp
590# if HAVE_RAW_DECL_MKOSTEMP 909# if HAVE_RAW_DECL_MKOSTEMP
@@ -607,14 +926,28 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
607 implementation. 926 implementation.
608 Returns the open file descriptor if successful, otherwise -1 and errno 927 Returns the open file descriptor if successful, otherwise -1 and errno
609 set. */ 928 set. */
610# if !@HAVE_MKOSTEMPS@ 929# if @REPLACE_MKOSTEMPS@
930# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
931# undef mkostemps
932# define mkostemps rpl_mkostemps
933# endif
934_GL_FUNCDECL_RPL (mkostemps, int,
935 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
936 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
937_GL_CXXALIAS_RPL (mkostemps, int,
938 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
939# else
940# if !@HAVE_MKOSTEMPS@
611_GL_FUNCDECL_SYS (mkostemps, int, 941_GL_FUNCDECL_SYS (mkostemps, int,
612 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 942 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
613 _GL_ARG_NONNULL ((1))); 943 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
614# endif 944# endif
615_GL_CXXALIAS_SYS (mkostemps, int, 945_GL_CXXALIAS_SYS (mkostemps, int,
616 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 946 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
947# endif
948# if __GLIBC__ >= 2
617_GL_CXXALIASWARN (mkostemps); 949_GL_CXXALIASWARN (mkostemps);
950# endif
618#elif defined GNULIB_POSIXCHECK 951#elif defined GNULIB_POSIXCHECK
619# undef mkostemps 952# undef mkostemps
620# if HAVE_RAW_DECL_MKOSTEMPS 953# if HAVE_RAW_DECL_MKOSTEMPS
@@ -637,11 +970,13 @@ _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
637# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 970# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
638# define mkstemp rpl_mkstemp 971# define mkstemp rpl_mkstemp
639# endif 972# endif
640_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 973_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/),
974 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
641_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); 975_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
642# else 976# else
643# if ! @HAVE_MKSTEMP@ 977# if ! @HAVE_MKSTEMP@
644_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 978_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/),
979 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
645# endif 980# endif
646_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); 981_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
647# endif 982# endif
@@ -666,8 +1001,8 @@ _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
666 Returns the open file descriptor if successful, otherwise -1 and errno 1001 Returns the open file descriptor if successful, otherwise -1 and errno
667 set. */ 1002 set. */
668# if !@HAVE_MKSTEMPS@ 1003# if !@HAVE_MKSTEMPS@
669_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) 1004_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/),
670 _GL_ARG_NONNULL ((1))); 1005 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
671# endif 1006# endif
672_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); 1007_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
673_GL_CXXALIASWARN (mkstemps); 1008_GL_CXXALIASWARN (mkstemps);
@@ -703,8 +1038,8 @@ _GL_CXXALIASWARN (mktemp);
703# define posix_memalign rpl_posix_memalign 1038# define posix_memalign rpl_posix_memalign
704# endif 1039# endif
705_GL_FUNCDECL_RPL (posix_memalign, int, 1040_GL_FUNCDECL_RPL (posix_memalign, int,
706 (void **memptr, size_t alignment, size_t size) 1041 (void **memptr, size_t alignment, size_t size),
707 _GL_ARG_NONNULL ((1))); 1042 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
708_GL_CXXALIAS_RPL (posix_memalign, int, 1043_GL_CXXALIAS_RPL (posix_memalign, int,
709 (void **memptr, size_t alignment, size_t size)); 1044 (void **memptr, size_t alignment, size_t size));
710# else 1045# else
@@ -713,7 +1048,7 @@ _GL_CXXALIAS_SYS (posix_memalign, int,
713 (void **memptr, size_t alignment, size_t size)); 1048 (void **memptr, size_t alignment, size_t size));
714# endif 1049# endif
715# endif 1050# endif
716# if @HAVE_POSIX_MEMALIGN@ 1051# if __GLIBC__ >= 2 && @HAVE_POSIX_MEMALIGN@
717_GL_CXXALIASWARN (posix_memalign); 1052_GL_CXXALIASWARN (posix_memalign);
718# endif 1053# endif
719#elif defined GNULIB_POSIXCHECK 1054#elif defined GNULIB_POSIXCHECK
@@ -727,11 +1062,22 @@ _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
727#if @GNULIB_POSIX_OPENPT@ 1062#if @GNULIB_POSIX_OPENPT@
728/* Return an FD open to the master side of a pseudo-terminal. Flags should 1063/* Return an FD open to the master side of a pseudo-terminal. Flags should
729 include O_RDWR, and may also include O_NOCTTY. */ 1064 include O_RDWR, and may also include O_NOCTTY. */
730# if !@HAVE_POSIX_OPENPT@ 1065# if @REPLACE_POSIX_OPENPT@
731_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); 1066# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
732# endif 1067# undef posix_openpt
1068# define posix_openpt rpl_posix_openpt
1069# endif
1070_GL_FUNCDECL_RPL (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
1071_GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
1072# else
1073# if !@HAVE_POSIX_OPENPT@
1074_GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
1075# endif
733_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); 1076_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
1077# endif
1078# if __GLIBC__ >= 2
734_GL_CXXALIASWARN (posix_openpt); 1079_GL_CXXALIASWARN (posix_openpt);
1080# endif
735#elif defined GNULIB_POSIXCHECK 1081#elif defined GNULIB_POSIXCHECK
736# undef posix_openpt 1082# undef posix_openpt
737# if HAVE_RAW_DECL_POSIX_OPENPT 1083# if HAVE_RAW_DECL_POSIX_OPENPT
@@ -748,11 +1094,11 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
748# undef ptsname 1094# undef ptsname
749# define ptsname rpl_ptsname 1095# define ptsname rpl_ptsname
750# endif 1096# endif
751_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); 1097_GL_FUNCDECL_RPL (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
752_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); 1098_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
753# else 1099# else
754# if !@HAVE_PTSNAME@ 1100# if !@HAVE_PTSNAME@
755_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 1101_GL_FUNCDECL_SYS (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
756# endif 1102# endif
757_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 1103_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
758# endif 1104# endif
@@ -774,11 +1120,11 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
774# undef ptsname_r 1120# undef ptsname_r
775# define ptsname_r rpl_ptsname_r 1121# define ptsname_r rpl_ptsname_r
776# endif 1122# endif
777_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 1123_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len), );
778_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 1124_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
779# else 1125# else
780# if !@HAVE_PTSNAME_R@ 1126# if !@HAVE_PTSNAME_R@
781_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1127_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len), );
782# endif 1128# endif
783_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1129_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
784# endif 1130# endif
@@ -800,7 +1146,7 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
800# undef putenv 1146# undef putenv
801# define putenv rpl_putenv 1147# define putenv rpl_putenv
802# endif 1148# endif
803_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 1149_GL_FUNCDECL_RPL (putenv, int, (char *string), _GL_ARG_NONNULL ((1)));
804_GL_CXXALIAS_RPL (putenv, int, (char *string)); 1150_GL_CXXALIAS_RPL (putenv, int, (char *string));
805# elif defined _WIN32 && !defined __CYGWIN__ 1151# elif defined _WIN32 && !defined __CYGWIN__
806# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1152# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -808,6 +1154,10 @@ _GL_CXXALIAS_RPL (putenv, int, (char *string));
808# define putenv _putenv 1154# define putenv _putenv
809# endif 1155# endif
810_GL_CXXALIAS_MDA (putenv, int, (char *string)); 1156_GL_CXXALIAS_MDA (putenv, int, (char *string));
1157# elif defined __KLIBC__
1158/* Need to cast, because on OS/2 kLIBC, the first parameter is
1159 const char *string. */
1160_GL_CXXALIAS_SYS_CAST (putenv, int, (char *string));
811# else 1161# else
812_GL_CXXALIAS_SYS (putenv, int, (char *string)); 1162_GL_CXXALIAS_SYS (putenv, int, (char *string));
813# endif 1163# endif
@@ -824,6 +1174,10 @@ _GL_CXXALIASWARN (putenv);
824/* Need to cast, because on mingw, the parameter is either 1174/* Need to cast, because on mingw, the parameter is either
825 'const char *string' or 'char *string'. */ 1175 'const char *string' or 'char *string'. */
826_GL_CXXALIAS_MDA_CAST (putenv, int, (char *string)); 1176_GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
1177# elif defined __KLIBC__
1178/* Need to cast, because on OS/2 kLIBC, the first parameter is
1179 const char *string. */
1180_GL_CXXALIAS_SYS_CAST (putenv, int, (char *string));
827# else 1181# else
828_GL_CXXALIAS_SYS (putenv, int, (char *string)); 1182_GL_CXXALIAS_SYS (putenv, int, (char *string));
829# endif 1183# endif
@@ -851,7 +1205,9 @@ typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
851# endif 1205# endif
852_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1206_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
853 _gl_qsort_r_compar_fn compare, 1207 _gl_qsort_r_compar_fn compare,
854 void *arg) _GL_ARG_NONNULL ((1, 4))); 1208 void *arg),
1209 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1210 _GL_ARG_NONNULL ((4)));
855_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1211_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
856 _gl_qsort_r_compar_fn compare, 1212 _gl_qsort_r_compar_fn compare,
857 void *arg)); 1213 void *arg));
@@ -859,13 +1215,17 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
859# if !@HAVE_QSORT_R@ 1215# if !@HAVE_QSORT_R@
860_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1216_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
861 _gl_qsort_r_compar_fn compare, 1217 _gl_qsort_r_compar_fn compare,
862 void *arg) _GL_ARG_NONNULL ((1, 4))); 1218 void *arg),
1219 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1220 _GL_ARG_NONNULL ((4)));
863# endif 1221# endif
864_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1222_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
865 _gl_qsort_r_compar_fn compare, 1223 _gl_qsort_r_compar_fn compare,
866 void *arg)); 1224 void *arg));
867# endif 1225# endif
1226# if __GLIBC__ >= 2
868_GL_CXXALIASWARN (qsort_r); 1227_GL_CXXALIASWARN (qsort_r);
1228# endif
869#elif defined GNULIB_POSIXCHECK 1229#elif defined GNULIB_POSIXCHECK
870# undef qsort_r 1230# undef qsort_r
871# if HAVE_RAW_DECL_QSORT_R 1231# if HAVE_RAW_DECL_QSORT_R
@@ -875,11 +1235,26 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
875#endif 1235#endif
876 1236
877 1237
878#if @GNULIB_RANDOM_R@ 1238#if @GNULIB_RAND@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@)
879# if !@HAVE_RANDOM_R@ 1239# ifndef RAND_MAX
880# ifndef RAND_MAX 1240# define RAND_MAX 2147483647
881# define RAND_MAX 2147483647 1241# endif
1242#endif
1243
1244
1245#if @GNULIB_RAND@
1246# if @REPLACE_RAND@
1247# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1248# undef rand
1249# define rand rpl_rand
882# endif 1250# endif
1251_GL_FUNCDECL_RPL (rand, int, (void), );
1252_GL_CXXALIAS_RPL (rand, int, (void));
1253# else
1254_GL_CXXALIAS_SYS (rand, int, (void));
1255# endif
1256# if __GLIBC__ >= 2
1257_GL_CXXALIASWARN (rand);
883# endif 1258# endif
884#endif 1259#endif
885 1260
@@ -890,17 +1265,19 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
890# undef random 1265# undef random
891# define random rpl_random 1266# define random rpl_random
892# endif 1267# endif
893_GL_FUNCDECL_RPL (random, long, (void)); 1268_GL_FUNCDECL_RPL (random, long, (void), );
894_GL_CXXALIAS_RPL (random, long, (void)); 1269_GL_CXXALIAS_RPL (random, long, (void));
895# else 1270# else
896# if !@HAVE_RANDOM@ 1271# if !@HAVE_RANDOM@
897_GL_FUNCDECL_SYS (random, long, (void)); 1272_GL_FUNCDECL_SYS (random, long, (void), );
898# endif 1273# endif
899/* Need to cast, because on Haiku, the return type is 1274/* Need to cast, because on Haiku, the return type is
900 int. */ 1275 int. */
901_GL_CXXALIAS_SYS_CAST (random, long, (void)); 1276_GL_CXXALIAS_SYS_CAST (random, long, (void));
902# endif 1277# endif
1278# if __GLIBC__ >= 2
903_GL_CXXALIASWARN (random); 1279_GL_CXXALIASWARN (random);
1280# endif
904#elif defined GNULIB_POSIXCHECK 1281#elif defined GNULIB_POSIXCHECK
905# undef random 1282# undef random
906# if HAVE_RAW_DECL_RANDOM 1283# if HAVE_RAW_DECL_RANDOM
@@ -915,17 +1292,19 @@ _GL_WARN_ON_USE (random, "random is unportable - "
915# undef srandom 1292# undef srandom
916# define srandom rpl_srandom 1293# define srandom rpl_srandom
917# endif 1294# endif
918_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); 1295_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed), );
919_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); 1296_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
920# else 1297# else
921# if !@HAVE_RANDOM@ 1298# if !@HAVE_RANDOM@
922_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 1299_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed), );
923# endif 1300# endif
924/* Need to cast, because on FreeBSD, the first parameter is 1301/* Need to cast, because on FreeBSD, the first parameter is
925 unsigned long seed. */ 1302 unsigned long seed. */
926_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); 1303_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
927# endif 1304# endif
1305# if __GLIBC__ >= 2
928_GL_CXXALIASWARN (srandom); 1306_GL_CXXALIASWARN (srandom);
1307# endif
929#elif defined GNULIB_POSIXCHECK 1308#elif defined GNULIB_POSIXCHECK
930# undef srandom 1309# undef srandom
931# if HAVE_RAW_DECL_SRANDOM 1310# if HAVE_RAW_DECL_SRANDOM
@@ -941,14 +1320,14 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
941# define initstate rpl_initstate 1320# define initstate rpl_initstate
942# endif 1321# endif
943_GL_FUNCDECL_RPL (initstate, char *, 1322_GL_FUNCDECL_RPL (initstate, char *,
944 (unsigned int seed, char *buf, size_t buf_size) 1323 (unsigned int seed, char *buf, size_t buf_size),
945 _GL_ARG_NONNULL ((2))); 1324 _GL_ARG_NONNULL ((2)));
946_GL_CXXALIAS_RPL (initstate, char *, 1325_GL_CXXALIAS_RPL (initstate, char *,
947 (unsigned int seed, char *buf, size_t buf_size)); 1326 (unsigned int seed, char *buf, size_t buf_size));
948# else 1327# else
949# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ 1328# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
950_GL_FUNCDECL_SYS (initstate, char *, 1329_GL_FUNCDECL_SYS (initstate, char *,
951 (unsigned int seed, char *buf, size_t buf_size) 1330 (unsigned int seed, char *buf, size_t buf_size),
952 _GL_ARG_NONNULL ((2))); 1331 _GL_ARG_NONNULL ((2)));
953# endif 1332# endif
954/* Need to cast, because on FreeBSD, the first parameter is 1333/* Need to cast, because on FreeBSD, the first parameter is
@@ -956,7 +1335,9 @@ _GL_FUNCDECL_SYS (initstate, char *,
956_GL_CXXALIAS_SYS_CAST (initstate, char *, 1335_GL_CXXALIAS_SYS_CAST (initstate, char *,
957 (unsigned int seed, char *buf, size_t buf_size)); 1336 (unsigned int seed, char *buf, size_t buf_size));
958# endif 1337# endif
1338# if __GLIBC__ >= 2
959_GL_CXXALIASWARN (initstate); 1339_GL_CXXALIASWARN (initstate);
1340# endif
960#elif defined GNULIB_POSIXCHECK 1341#elif defined GNULIB_POSIXCHECK
961# undef initstate 1342# undef initstate
962# if HAVE_RAW_DECL_INITSTATE 1343# if HAVE_RAW_DECL_INITSTATE
@@ -971,17 +1352,19 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - "
971# undef setstate 1352# undef setstate
972# define setstate rpl_setstate 1353# define setstate rpl_setstate
973# endif 1354# endif
974_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1355_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
975_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); 1356_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
976# else 1357# else
977# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ 1358# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
978_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1359_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
979# endif 1360# endif
980/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter 1361/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
981 is const char *arg_state. */ 1362 is const char *arg_state. */
982_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); 1363_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
983# endif 1364# endif
1365# if __GLIBC__ >= 2
984_GL_CXXALIASWARN (setstate); 1366_GL_CXXALIASWARN (setstate);
1367# endif
985#elif defined GNULIB_POSIXCHECK 1368#elif defined GNULIB_POSIXCHECK
986# undef setstate 1369# undef setstate
987# if HAVE_RAW_DECL_SETSTATE 1370# if HAVE_RAW_DECL_SETSTATE
@@ -997,12 +1380,12 @@ _GL_WARN_ON_USE (setstate, "setstate is unportable - "
997# undef random_r 1380# undef random_r
998# define random_r rpl_random_r 1381# define random_r rpl_random_r
999# endif 1382# endif
1000_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) 1383_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result),
1001 _GL_ARG_NONNULL ((1, 2))); 1384 _GL_ARG_NONNULL ((1, 2)));
1002_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); 1385_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1003# else 1386# else
1004# if !@HAVE_RANDOM_R@ 1387# if !@HAVE_RANDOM_R@
1005_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 1388_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result),
1006 _GL_ARG_NONNULL ((1, 2))); 1389 _GL_ARG_NONNULL ((1, 2)));
1007# endif 1390# endif
1008_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 1391_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
@@ -1023,14 +1406,14 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1023# define srandom_r rpl_srandom_r 1406# define srandom_r rpl_srandom_r
1024# endif 1407# endif
1025_GL_FUNCDECL_RPL (srandom_r, int, 1408_GL_FUNCDECL_RPL (srandom_r, int,
1026 (unsigned int seed, struct random_data *rand_state) 1409 (unsigned int seed, struct random_data *rand_state),
1027 _GL_ARG_NONNULL ((2))); 1410 _GL_ARG_NONNULL ((2)));
1028_GL_CXXALIAS_RPL (srandom_r, int, 1411_GL_CXXALIAS_RPL (srandom_r, int,
1029 (unsigned int seed, struct random_data *rand_state)); 1412 (unsigned int seed, struct random_data *rand_state));
1030# else 1413# else
1031# if !@HAVE_RANDOM_R@ 1414# if !@HAVE_RANDOM_R@
1032_GL_FUNCDECL_SYS (srandom_r, int, 1415_GL_FUNCDECL_SYS (srandom_r, int,
1033 (unsigned int seed, struct random_data *rand_state) 1416 (unsigned int seed, struct random_data *rand_state),
1034 _GL_ARG_NONNULL ((2))); 1417 _GL_ARG_NONNULL ((2)));
1035# endif 1418# endif
1036_GL_CXXALIAS_SYS (srandom_r, int, 1419_GL_CXXALIAS_SYS (srandom_r, int,
@@ -1053,7 +1436,7 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1053# endif 1436# endif
1054_GL_FUNCDECL_RPL (initstate_r, int, 1437_GL_FUNCDECL_RPL (initstate_r, int,
1055 (unsigned int seed, char *buf, size_t buf_size, 1438 (unsigned int seed, char *buf, size_t buf_size,
1056 struct random_data *rand_state) 1439 struct random_data *rand_state),
1057 _GL_ARG_NONNULL ((2, 4))); 1440 _GL_ARG_NONNULL ((2, 4)));
1058_GL_CXXALIAS_RPL (initstate_r, int, 1441_GL_CXXALIAS_RPL (initstate_r, int,
1059 (unsigned int seed, char *buf, size_t buf_size, 1442 (unsigned int seed, char *buf, size_t buf_size,
@@ -1062,7 +1445,7 @@ _GL_CXXALIAS_RPL (initstate_r, int,
1062# if !@HAVE_RANDOM_R@ 1445# if !@HAVE_RANDOM_R@
1063_GL_FUNCDECL_SYS (initstate_r, int, 1446_GL_FUNCDECL_SYS (initstate_r, int,
1064 (unsigned int seed, char *buf, size_t buf_size, 1447 (unsigned int seed, char *buf, size_t buf_size,
1065 struct random_data *rand_state) 1448 struct random_data *rand_state),
1066 _GL_ARG_NONNULL ((2, 4))); 1449 _GL_ARG_NONNULL ((2, 4)));
1067# endif 1450# endif
1068/* Need to cast, because on Haiku, the third parameter is 1451/* Need to cast, because on Haiku, the third parameter is
@@ -1087,14 +1470,14 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1087# define setstate_r rpl_setstate_r 1470# define setstate_r rpl_setstate_r
1088# endif 1471# endif
1089_GL_FUNCDECL_RPL (setstate_r, int, 1472_GL_FUNCDECL_RPL (setstate_r, int,
1090 (char *arg_state, struct random_data *rand_state) 1473 (char *arg_state, struct random_data *rand_state),
1091 _GL_ARG_NONNULL ((1, 2))); 1474 _GL_ARG_NONNULL ((1, 2)));
1092_GL_CXXALIAS_RPL (setstate_r, int, 1475_GL_CXXALIAS_RPL (setstate_r, int,
1093 (char *arg_state, struct random_data *rand_state)); 1476 (char *arg_state, struct random_data *rand_state));
1094# else 1477# else
1095# if !@HAVE_RANDOM_R@ 1478# if !@HAVE_RANDOM_R@
1096_GL_FUNCDECL_SYS (setstate_r, int, 1479_GL_FUNCDECL_SYS (setstate_r, int,
1097 (char *arg_state, struct random_data *rand_state) 1480 (char *arg_state, struct random_data *rand_state),
1098 _GL_ARG_NONNULL ((1, 2))); 1481 _GL_ARG_NONNULL ((1, 2)));
1099# endif 1482# endif
1100/* Need to cast, because on Haiku, the first parameter is 1483/* Need to cast, because on Haiku, the first parameter is
@@ -1113,21 +1496,45 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1113 1496
1114 1497
1115#if @GNULIB_REALLOC_POSIX@ 1498#if @GNULIB_REALLOC_POSIX@
1116# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \ 1499# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
1117 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@) 1500# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
1501# define _GL_INLINE_RPL_REALLOC 1
1502# ifdef __cplusplus
1503extern "C" {
1504# endif
1505_GL_REALLOC_INLINE void *
1506rpl_realloc (void *ptr, size_t size)
1507{
1508 return realloc (ptr, size ? size : 1);
1509}
1510# ifdef __cplusplus
1511}
1512# endif
1513# endif
1118# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 1514# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1119 || _GL_USE_STDLIB_ALLOC) 1515 || _GL_USE_STDLIB_ALLOC)
1120# undef realloc 1516# undef realloc
1121# define realloc rpl_realloc 1517# define realloc rpl_realloc
1122# endif 1518# endif
1123_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) 1519# if !defined _GL_INLINE_RPL_REALLOC
1124 _GL_ATTRIBUTE_DEALLOC_FREE); 1520_GL_FUNCDECL_RPL (realloc, void *,
1521 (void *ptr, size_t size),
1522 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1523# endif
1125_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 1524_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1126# else 1525# else
1127# if __GNUC__ >= 11 1526# if __GNUC__ >= 11 && !defined __clang__
1128/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1527/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1129_GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) 1528# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1130 _GL_ATTRIBUTE_DEALLOC_FREE); 1529_GL_FUNCDECL_SYS (realloc, void *,
1530 (void *ptr, size_t size),
1531 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD)
1532 _GL_ATTRIBUTE_NOTHROW;
1533# else
1534_GL_FUNCDECL_SYS (realloc, void *,
1535 (void *ptr, size_t size),
1536 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1537# endif
1131# endif 1538# endif
1132_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 1539_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1133# endif 1540# endif
@@ -1135,10 +1542,19 @@ _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1135_GL_CXXALIASWARN (realloc); 1542_GL_CXXALIASWARN (realloc);
1136# endif 1543# endif
1137#else 1544#else
1138# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc 1545# if @GNULIB_FREE_POSIX@ \
1546 && (__GNUC__ >= 11 && !defined __clang__) && !defined realloc
1139/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1547/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1140_GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) 1548# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1141 _GL_ATTRIBUTE_DEALLOC_FREE); 1549_GL_FUNCDECL_SYS (realloc, void *,
1550 (void *ptr, size_t size),
1551 _GL_ATTRIBUTE_DEALLOC_FREE)
1552 _GL_ATTRIBUTE_NOTHROW;
1553# else
1554_GL_FUNCDECL_SYS (realloc, void *,
1555 (void *ptr, size_t size),
1556 _GL_ATTRIBUTE_DEALLOC_FREE);
1557# endif
1142# endif 1558# endif
1143# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 1559# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1144# undef realloc 1560# undef realloc
@@ -1156,18 +1572,22 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1156# define reallocarray rpl_reallocarray 1572# define reallocarray rpl_reallocarray
1157# endif 1573# endif
1158_GL_FUNCDECL_RPL (reallocarray, void *, 1574_GL_FUNCDECL_RPL (reallocarray, void *,
1159 (void *ptr, size_t nmemb, size_t size)); 1575 (void *ptr, size_t nmemb, size_t size),
1576 _GL_ATTRIBUTE_NODISCARD);
1160_GL_CXXALIAS_RPL (reallocarray, void *, 1577_GL_CXXALIAS_RPL (reallocarray, void *,
1161 (void *ptr, size_t nmemb, size_t size)); 1578 (void *ptr, size_t nmemb, size_t size));
1162# else 1579# else
1163# if ! @HAVE_REALLOCARRAY@ 1580# if ! @HAVE_REALLOCARRAY@
1164_GL_FUNCDECL_SYS (reallocarray, void *, 1581_GL_FUNCDECL_SYS (reallocarray, void *,
1165 (void *ptr, size_t nmemb, size_t size)); 1582 (void *ptr, size_t nmemb, size_t size),
1583 _GL_ATTRIBUTE_NODISCARD);
1166# endif 1584# endif
1167_GL_CXXALIAS_SYS (reallocarray, void *, 1585_GL_CXXALIAS_SYS (reallocarray, void *,
1168 (void *ptr, size_t nmemb, size_t size)); 1586 (void *ptr, size_t nmemb, size_t size));
1169# endif 1587# endif
1588# if __GLIBC__ >= 2
1170_GL_CXXALIASWARN (reallocarray); 1589_GL_CXXALIASWARN (reallocarray);
1590# endif
1171#elif defined GNULIB_POSIXCHECK 1591#elif defined GNULIB_POSIXCHECK
1172# undef reallocarray 1592# undef reallocarray
1173# if HAVE_RAW_DECL_REALLOCARRAY 1593# if HAVE_RAW_DECL_REALLOCARRAY
@@ -1182,15 +1602,15 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1182# define realpath rpl_realpath 1602# define realpath rpl_realpath
1183# endif 1603# endif
1184_GL_FUNCDECL_RPL (realpath, char *, 1604_GL_FUNCDECL_RPL (realpath, char *,
1185 (const char *restrict name, char *restrict resolved) 1605 (const char *restrict name, char *restrict resolved),
1186 _GL_ARG_NONNULL ((1))); 1606 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1187_GL_CXXALIAS_RPL (realpath, char *, 1607_GL_CXXALIAS_RPL (realpath, char *,
1188 (const char *restrict name, char *restrict resolved)); 1608 (const char *restrict name, char *restrict resolved));
1189# else 1609# else
1190# if !@HAVE_REALPATH@ 1610# if !@HAVE_REALPATH@
1191_GL_FUNCDECL_SYS (realpath, char *, 1611_GL_FUNCDECL_SYS (realpath, char *,
1192 (const char *restrict name, char *restrict resolved) 1612 (const char *restrict name, char *restrict resolved),
1193 _GL_ARG_NONNULL ((1))); 1613 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1194# endif 1614# endif
1195_GL_CXXALIAS_SYS (realpath, char *, 1615_GL_CXXALIAS_SYS (realpath, char *,
1196 (const char *restrict name, char *restrict resolved)); 1616 (const char *restrict name, char *restrict resolved));
@@ -1208,7 +1628,8 @@ _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1208/* Test a user response to a question. 1628/* Test a user response to a question.
1209 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ 1629 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1210# if !@HAVE_RPMATCH@ 1630# if !@HAVE_RPMATCH@
1211_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); 1631_GL_FUNCDECL_SYS (rpmatch, int, (const char *response),
1632 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1212# endif 1633# endif
1213_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); 1634_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1214_GL_CXXALIASWARN (rpmatch); 1635_GL_CXXALIASWARN (rpmatch);
@@ -1224,7 +1645,8 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1224/* Look up NAME in the environment, returning 0 in insecure situations. */ 1645/* Look up NAME in the environment, returning 0 in insecure situations. */
1225# if !@HAVE_SECURE_GETENV@ 1646# if !@HAVE_SECURE_GETENV@
1226_GL_FUNCDECL_SYS (secure_getenv, char *, 1647_GL_FUNCDECL_SYS (secure_getenv, char *,
1227 (char const *name) _GL_ARG_NONNULL ((1))); 1648 (char const *name),
1649 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1228# endif 1650# endif
1229_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); 1651_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1230_GL_CXXALIASWARN (secure_getenv); 1652_GL_CXXALIASWARN (secure_getenv);
@@ -1245,14 +1667,14 @@ _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1245# define setenv rpl_setenv 1667# define setenv rpl_setenv
1246# endif 1668# endif
1247_GL_FUNCDECL_RPL (setenv, int, 1669_GL_FUNCDECL_RPL (setenv, int,
1248 (const char *name, const char *value, int replace) 1670 (const char *name, const char *value, int replace),
1249 _GL_ARG_NONNULL ((1))); 1671 _GL_ARG_NONNULL ((1)));
1250_GL_CXXALIAS_RPL (setenv, int, 1672_GL_CXXALIAS_RPL (setenv, int,
1251 (const char *name, const char *value, int replace)); 1673 (const char *name, const char *value, int replace));
1252# else 1674# else
1253# if !@HAVE_DECL_SETENV@ 1675# if !@HAVE_DECL_SETENV@
1254_GL_FUNCDECL_SYS (setenv, int, 1676_GL_FUNCDECL_SYS (setenv, int,
1255 (const char *name, const char *value, int replace) 1677 (const char *name, const char *value, int replace),
1256 _GL_ARG_NONNULL ((1))); 1678 _GL_ARG_NONNULL ((1)));
1257# endif 1679# endif
1258_GL_CXXALIAS_SYS (setenv, int, 1680_GL_CXXALIAS_SYS (setenv, int,
@@ -1269,6 +1691,19 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1269# endif 1691# endif
1270#endif 1692#endif
1271 1693
1694#if @GNULIB_STACK_TRACE@
1695/* Prints a stack trace of the current thread to standard error,
1696 if possible. */
1697# if @CAN_PRINT_STACK_TRACE@
1698_GL_EXTERN_C void print_stack_trace (void);
1699# else
1700# if !GNULIB_defined_print_stack_trace
1701# define print_stack_trace() /* nothing */
1702# define GNULIB_defined_print_stack_trace 1
1703# endif
1704# endif
1705#endif
1706
1272#if @GNULIB_STRTOD@ 1707#if @GNULIB_STRTOD@
1273 /* Parse a double from STRING, updating ENDP if appropriate. */ 1708 /* Parse a double from STRING, updating ENDP if appropriate. */
1274# if @REPLACE_STRTOD@ 1709# if @REPLACE_STRTOD@
@@ -1277,14 +1712,14 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1277# endif 1712# endif
1278# define GNULIB_defined_strtod_function 1 1713# define GNULIB_defined_strtod_function 1
1279_GL_FUNCDECL_RPL (strtod, double, 1714_GL_FUNCDECL_RPL (strtod, double,
1280 (const char *restrict str, char **restrict endp) 1715 (const char *restrict str, char **restrict endp),
1281 _GL_ARG_NONNULL ((1))); 1716 _GL_ARG_NONNULL ((1)));
1282_GL_CXXALIAS_RPL (strtod, double, 1717_GL_CXXALIAS_RPL (strtod, double,
1283 (const char *restrict str, char **restrict endp)); 1718 (const char *restrict str, char **restrict endp));
1284# else 1719# else
1285# if !@HAVE_STRTOD@ 1720# if !@HAVE_STRTOD@
1286_GL_FUNCDECL_SYS (strtod, double, 1721_GL_FUNCDECL_SYS (strtod, double,
1287 (const char *restrict str, char **restrict endp) 1722 (const char *restrict str, char **restrict endp),
1288 _GL_ARG_NONNULL ((1))); 1723 _GL_ARG_NONNULL ((1)));
1289# endif 1724# endif
1290_GL_CXXALIAS_SYS (strtod, double, 1725_GL_CXXALIAS_SYS (strtod, double,
@@ -1301,6 +1736,38 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1301# endif 1736# endif
1302#endif 1737#endif
1303 1738
1739#if @GNULIB_STRTOF@
1740 /* Parse a float from STRING, updating ENDP if appropriate. */
1741# if @REPLACE_STRTOF@
1742# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1743# define strtof rpl_strtof
1744# endif
1745# define GNULIB_defined_strtof_function 1
1746_GL_FUNCDECL_RPL (strtof, float,
1747 (const char *restrict str, char **restrict endp),
1748 _GL_ARG_NONNULL ((1)));
1749_GL_CXXALIAS_RPL (strtof, float,
1750 (const char *restrict str, char **restrict endp));
1751# else
1752# if !@HAVE_STRTOF@
1753_GL_FUNCDECL_SYS (strtof, float,
1754 (const char *restrict str, char **restrict endp),
1755 _GL_ARG_NONNULL ((1)));
1756# endif
1757_GL_CXXALIAS_SYS (strtof, float,
1758 (const char *restrict str, char **restrict endp));
1759# endif
1760# if __GLIBC__ >= 2
1761_GL_CXXALIASWARN (strtof);
1762# endif
1763#elif defined GNULIB_POSIXCHECK
1764# undef strtof
1765# if HAVE_RAW_DECL_STRTOF
1766_GL_WARN_ON_USE (strtof, "strtof is unportable - "
1767 "use gnulib module strtof for portability");
1768# endif
1769#endif
1770
1304#if @GNULIB_STRTOLD@ 1771#if @GNULIB_STRTOLD@
1305 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ 1772 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
1306# if @REPLACE_STRTOLD@ 1773# if @REPLACE_STRTOLD@
@@ -1309,14 +1776,14 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1309# endif 1776# endif
1310# define GNULIB_defined_strtold_function 1 1777# define GNULIB_defined_strtold_function 1
1311_GL_FUNCDECL_RPL (strtold, long double, 1778_GL_FUNCDECL_RPL (strtold, long double,
1312 (const char *restrict str, char **restrict endp) 1779 (const char *restrict str, char **restrict endp),
1313 _GL_ARG_NONNULL ((1))); 1780 _GL_ARG_NONNULL ((1)));
1314_GL_CXXALIAS_RPL (strtold, long double, 1781_GL_CXXALIAS_RPL (strtold, long double,
1315 (const char *restrict str, char **restrict endp)); 1782 (const char *restrict str, char **restrict endp));
1316# else 1783# else
1317# if !@HAVE_STRTOLD@ 1784# if !@HAVE_STRTOLD@
1318_GL_FUNCDECL_SYS (strtold, long double, 1785_GL_FUNCDECL_SYS (strtold, long double,
1319 (const char *restrict str, char **restrict endp) 1786 (const char *restrict str, char **restrict endp),
1320 _GL_ARG_NONNULL ((1))); 1787 _GL_ARG_NONNULL ((1)));
1321# endif 1788# endif
1322_GL_CXXALIAS_SYS (strtold, long double, 1789_GL_CXXALIAS_SYS (strtold, long double,
@@ -1347,7 +1814,7 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1347# define GNULIB_defined_strtol_function 1 1814# define GNULIB_defined_strtol_function 1
1348_GL_FUNCDECL_RPL (strtol, long, 1815_GL_FUNCDECL_RPL (strtol, long,
1349 (const char *restrict string, char **restrict endptr, 1816 (const char *restrict string, char **restrict endptr,
1350 int base) 1817 int base),
1351 _GL_ARG_NONNULL ((1))); 1818 _GL_ARG_NONNULL ((1)));
1352_GL_CXXALIAS_RPL (strtol, long, 1819_GL_CXXALIAS_RPL (strtol, long,
1353 (const char *restrict string, char **restrict endptr, 1820 (const char *restrict string, char **restrict endptr,
@@ -1356,7 +1823,7 @@ _GL_CXXALIAS_RPL (strtol, long,
1356# if !@HAVE_STRTOL@ 1823# if !@HAVE_STRTOL@
1357_GL_FUNCDECL_SYS (strtol, long, 1824_GL_FUNCDECL_SYS (strtol, long,
1358 (const char *restrict string, char **restrict endptr, 1825 (const char *restrict string, char **restrict endptr,
1359 int base) 1826 int base),
1360 _GL_ARG_NONNULL ((1))); 1827 _GL_ARG_NONNULL ((1)));
1361# endif 1828# endif
1362_GL_CXXALIAS_SYS (strtol, long, 1829_GL_CXXALIAS_SYS (strtol, long,
@@ -1390,7 +1857,7 @@ _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1390# define GNULIB_defined_strtoll_function 1 1857# define GNULIB_defined_strtoll_function 1
1391_GL_FUNCDECL_RPL (strtoll, long long, 1858_GL_FUNCDECL_RPL (strtoll, long long,
1392 (const char *restrict string, char **restrict endptr, 1859 (const char *restrict string, char **restrict endptr,
1393 int base) 1860 int base),
1394 _GL_ARG_NONNULL ((1))); 1861 _GL_ARG_NONNULL ((1)));
1395_GL_CXXALIAS_RPL (strtoll, long long, 1862_GL_CXXALIAS_RPL (strtoll, long long,
1396 (const char *restrict string, char **restrict endptr, 1863 (const char *restrict string, char **restrict endptr,
@@ -1399,7 +1866,7 @@ _GL_CXXALIAS_RPL (strtoll, long long,
1399# if !@HAVE_STRTOLL@ 1866# if !@HAVE_STRTOLL@
1400_GL_FUNCDECL_SYS (strtoll, long long, 1867_GL_FUNCDECL_SYS (strtoll, long long,
1401 (const char *restrict string, char **restrict endptr, 1868 (const char *restrict string, char **restrict endptr,
1402 int base) 1869 int base),
1403 _GL_ARG_NONNULL ((1))); 1870 _GL_ARG_NONNULL ((1)));
1404# endif 1871# endif
1405_GL_CXXALIAS_SYS (strtoll, long long, 1872_GL_CXXALIAS_SYS (strtoll, long long,
@@ -1430,7 +1897,7 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1430# define GNULIB_defined_strtoul_function 1 1897# define GNULIB_defined_strtoul_function 1
1431_GL_FUNCDECL_RPL (strtoul, unsigned long, 1898_GL_FUNCDECL_RPL (strtoul, unsigned long,
1432 (const char *restrict string, char **restrict endptr, 1899 (const char *restrict string, char **restrict endptr,
1433 int base) 1900 int base),
1434 _GL_ARG_NONNULL ((1))); 1901 _GL_ARG_NONNULL ((1)));
1435_GL_CXXALIAS_RPL (strtoul, unsigned long, 1902_GL_CXXALIAS_RPL (strtoul, unsigned long,
1436 (const char *restrict string, char **restrict endptr, 1903 (const char *restrict string, char **restrict endptr,
@@ -1439,7 +1906,7 @@ _GL_CXXALIAS_RPL (strtoul, unsigned long,
1439# if !@HAVE_STRTOUL@ 1906# if !@HAVE_STRTOUL@
1440_GL_FUNCDECL_SYS (strtoul, unsigned long, 1907_GL_FUNCDECL_SYS (strtoul, unsigned long,
1441 (const char *restrict string, char **restrict endptr, 1908 (const char *restrict string, char **restrict endptr,
1442 int base) 1909 int base),
1443 _GL_ARG_NONNULL ((1))); 1910 _GL_ARG_NONNULL ((1)));
1444# endif 1911# endif
1445_GL_CXXALIAS_SYS (strtoul, unsigned long, 1912_GL_CXXALIAS_SYS (strtoul, unsigned long,
@@ -1473,7 +1940,7 @@ _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1473# define GNULIB_defined_strtoull_function 1 1940# define GNULIB_defined_strtoull_function 1
1474_GL_FUNCDECL_RPL (strtoull, unsigned long long, 1941_GL_FUNCDECL_RPL (strtoull, unsigned long long,
1475 (const char *restrict string, char **restrict endptr, 1942 (const char *restrict string, char **restrict endptr,
1476 int base) 1943 int base),
1477 _GL_ARG_NONNULL ((1))); 1944 _GL_ARG_NONNULL ((1)));
1478_GL_CXXALIAS_RPL (strtoull, unsigned long long, 1945_GL_CXXALIAS_RPL (strtoull, unsigned long long,
1479 (const char *restrict string, char **restrict endptr, 1946 (const char *restrict string, char **restrict endptr,
@@ -1482,7 +1949,7 @@ _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1482# if !@HAVE_STRTOULL@ 1949# if !@HAVE_STRTOULL@
1483_GL_FUNCDECL_SYS (strtoull, unsigned long long, 1950_GL_FUNCDECL_SYS (strtoull, unsigned long long,
1484 (const char *restrict string, char **restrict endptr, 1951 (const char *restrict string, char **restrict endptr,
1485 int base) 1952 int base),
1486 _GL_ARG_NONNULL ((1))); 1953 _GL_ARG_NONNULL ((1)));
1487# endif 1954# endif
1488_GL_CXXALIAS_SYS (strtoull, unsigned long long, 1955_GL_CXXALIAS_SYS (strtoull, unsigned long long,
@@ -1502,7 +1969,7 @@ _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1502/* Unlock the slave side of the pseudo-terminal whose master side is specified 1969/* Unlock the slave side of the pseudo-terminal whose master side is specified
1503 by FD, so that it can be opened. */ 1970 by FD, so that it can be opened. */
1504# if !@HAVE_UNLOCKPT@ 1971# if !@HAVE_UNLOCKPT@
1505_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); 1972_GL_FUNCDECL_SYS (unlockpt, int, (int fd), );
1506# endif 1973# endif
1507_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); 1974_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1508_GL_CXXALIASWARN (unlockpt); 1975_GL_CXXALIASWARN (unlockpt);
@@ -1521,11 +1988,11 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1521# undef unsetenv 1988# undef unsetenv
1522# define unsetenv rpl_unsetenv 1989# define unsetenv rpl_unsetenv
1523# endif 1990# endif
1524_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1991_GL_FUNCDECL_RPL (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1525_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 1992_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1526# else 1993# else
1527# if !@HAVE_DECL_UNSETENV@ 1994# if !@HAVE_DECL_UNSETENV@
1528_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1995_GL_FUNCDECL_SYS (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1529# endif 1996# endif
1530_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 1997_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1531# endif 1998# endif
@@ -1547,7 +2014,7 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1547# undef wctomb 2014# undef wctomb
1548# define wctomb rpl_wctomb 2015# define wctomb rpl_wctomb
1549# endif 2016# endif
1550_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); 2017_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc), );
1551_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); 2018_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1552# else 2019# else
1553_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 2020_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
@@ -1558,6 +2025,8 @@ _GL_CXXALIASWARN (wctomb);
1558#endif 2025#endif
1559 2026
1560 2027
2028_GL_INLINE_HEADER_END
2029
1561#endif /* _@GUARD_PREFIX@_STDLIB_H */ 2030#endif /* _@GUARD_PREFIX@_STDLIB_H */
1562#endif /* _@GUARD_PREFIX@_STDLIB_H */ 2031#endif /* _@GUARD_PREFIX@_STDLIB_H */
1563#endif 2032#endif