1 /* A GNU-like <stdlib.h>.
3 Copyright (C) 1995, 2001-2004, 2006-2024 Free Software Foundation, Inc.
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19 @PRAGMA_SYSTEM_HEADER@
23 #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
24 /* Special invocation conventions inside some gnulib header files,
25 and inside some glibc header files, respectively. */
27 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
29 /* Make sure that the macros that indicate the special invocation convention
30 get undefined. This is needed at least on CentOS 7. */
31 #undef __need_malloc_and_calloc
34 /* Normal invocation convention. */
36 #ifndef _@GUARD_PREFIX@_STDLIB_H
38 /* The include_next requires a split double-inclusion guard. */
39 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
41 #ifndef _@GUARD_PREFIX@_STDLIB_H
42 #define _@GUARD_PREFIX@_STDLIB_H
44 /* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
45 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
47 #if !_GL_CONFIG_H_INCLUDED
48 #error "Please include config.h first."
51 /* NetBSD 5.0 mis-defines NULL. */
54 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
55 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
56 # include <sys/wait.h>
59 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
60 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
61 /* OpenIndiana has a bug: <sys/time.h> must be included before
63 # include <sys/time.h>
64 # include <sys/loadavg.h>
67 /* Native Windows platforms declare _mktemp() in <io.h>. */
68 #if defined _WIN32 && !defined __CYGWIN__
74 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
75 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
76 'struct random_data'. */
83 # if !@HAVE_STRUCT_RANDOM_DATA@
84 /* Define 'struct random_data'.
85 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
86 # if !GNULIB_defined_struct_random_data
89 int32_t *fptr
; /* Front pointer. */
90 int32_t *rptr
; /* Rear pointer. */
91 int32_t *state
; /* Array of state values. */
92 int rand_type
; /* Type of random number generator. */
93 int rand_deg
; /* Degree of random number generator. */
94 int rand_sep
; /* Distance between front and rear. */
95 int32_t *end_ptr
; /* Pointer behind state table. */
97 # define GNULIB_defined_struct_random_data 1
102 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
103 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
104 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
105 /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */
106 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
107 /* But avoid namespace pollution on glibc systems and native Windows. */
111 /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
112 that can be freed by passing them as the Ith argument to the
114 #ifndef _GL_ATTRIBUTE_DEALLOC
116 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
118 # define _GL_ATTRIBUTE_DEALLOC(f, i)
122 /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
123 can be freed via 'free'; it can be used only after declaring 'free'. */
124 /* Applies to: functions. Cannot be used on inline functions. */
125 #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
126 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
129 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
131 /* Applies to: functions. */
132 #ifndef _GL_ATTRIBUTE_MALLOC
133 # if __GNUC__ >= 3 || defined __clang__
134 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
136 # define _GL_ATTRIBUTE_MALLOC
140 /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
142 #ifndef _GL_ATTRIBUTE_NOTHROW
143 # if defined __cplusplus
144 # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
145 # if __cplusplus >= 201103L
146 # define _GL_ATTRIBUTE_NOTHROW noexcept (true)
148 # define _GL_ATTRIBUTE_NOTHROW throw ()
151 # define _GL_ATTRIBUTE_NOTHROW
154 # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
155 # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
157 # define _GL_ATTRIBUTE_NOTHROW
162 /* The __attribute__ feature is available in gcc versions 2.5 and later.
163 The attribute __pure__ was added in gcc 2.96. */
164 #ifndef _GL_ATTRIBUTE_PURE
165 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
166 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
168 # define _GL_ATTRIBUTE_PURE /* empty */
172 /* The definition of _Noreturn is copied here. */
174 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
176 /* The definition of _GL_ARG_NONNULL is copied here. */
178 /* The definition of _GL_WARN_ON_USE is copied here. */
181 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
183 # define EXIT_SUCCESS 0
185 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
186 with proper operation of xargs. */
188 # define EXIT_FAILURE 1
189 #elif EXIT_FAILURE != 1
191 # define EXIT_FAILURE 1
196 /* Terminate the current process with the given return code, without running
197 the 'atexit' handlers. */
199 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
201 # define _Exit rpl__Exit
203 _GL_FUNCDECL_RPL (_Exit
, _Noreturn
void, (int status
));
204 _GL_CXXALIAS_RPL (_Exit
, void, (int status
));
207 _GL_FUNCDECL_SYS (_Exit
, _Noreturn
void, (int status
));
209 _GL_CXXALIAS_SYS (_Exit
, void, (int status
));
212 _GL_CXXALIASWARN (_Exit
);
214 #elif defined GNULIB_POSIXCHECK
216 # if HAVE_RAW_DECL__EXIT
217 _GL_WARN_ON_USE (_Exit
, "_Exit is unportable - "
218 "use gnulib module _Exit for portability");
223 #if @GNULIB_ABORT_DEBUG@
225 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
227 # define abort rpl_abort
229 _GL_FUNCDECL_RPL (abort
, _Noreturn
void, (void));
230 _GL_CXXALIAS_RPL (abort
, void, (void));
232 _GL_CXXALIAS_SYS (abort
, void, (void));
235 _GL_CXXALIASWARN (abort
);
238 #if @GNULIB_ABORT_DEBUG@ && @REPLACE_ABORT@
239 _GL_EXTERN_C
void _gl_pre_abort (void);
241 # if !GNULIB_defined_gl_pre_abort
242 # define _gl_pre_abort() /* nothing */
243 # define GNULIB_defined_gl_pre_abort 1
248 #if @GNULIB_FREE_POSIX@
250 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
252 # define free rpl_free
254 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
255 _GL_FUNCDECL_RPL (free
, void, (void *ptr
) _GL_ATTRIBUTE_NOTHROW
);
257 _GL_FUNCDECL_RPL (free
, void, (void *ptr
));
259 _GL_CXXALIAS_RPL (free
, void, (void *ptr
));
261 _GL_CXXALIAS_SYS (free
, void, (void *ptr
));
264 _GL_CXXALIASWARN (free
);
266 #elif defined GNULIB_POSIXCHECK
268 /* Assume free is always declared. */
269 _GL_WARN_ON_USE (free
, "free is not future POSIX compliant everywhere - "
270 "use gnulib module free for portability");
274 /* Allocate memory with indefinite extent and specified alignment. */
275 #if @GNULIB_ALIGNED_ALLOC@
276 # if @REPLACE_ALIGNED_ALLOC@
277 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
278 # undef aligned_alloc
279 # define aligned_alloc rpl_aligned_alloc
281 _GL_FUNCDECL_RPL (aligned_alloc
, void *,
282 (size_t alignment
, size_t size
)
283 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
284 _GL_CXXALIAS_RPL (aligned_alloc
, void *, (size_t alignment
, size_t size
));
286 # if @HAVE_ALIGNED_ALLOC@
288 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
289 # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
290 _GL_FUNCDECL_SYS (aligned_alloc
, void *,
291 (size_t alignment
, size_t size
)
292 _GL_ATTRIBUTE_NOTHROW
293 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
295 _GL_FUNCDECL_SYS (aligned_alloc
, void *,
296 (size_t alignment
, size_t size
)
297 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
300 _GL_CXXALIAS_SYS (aligned_alloc
, void *, (size_t alignment
, size_t size
));
303 # if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@
304 _GL_CXXALIASWARN (aligned_alloc
);
307 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc
308 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
309 # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
310 _GL_FUNCDECL_SYS (aligned_alloc
, void *,
311 (size_t alignment
, size_t size
)
312 _GL_ATTRIBUTE_NOTHROW
313 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
315 _GL_FUNCDECL_SYS (aligned_alloc
, void *,
316 (size_t alignment
, size_t size
)
317 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
320 # if defined GNULIB_POSIXCHECK
321 # undef aligned_alloc
322 # if HAVE_RAW_DECL_ALIGNED_ALLOC
323 _GL_WARN_ON_USE (aligned_alloc
, "aligned_alloc is not portable - "
324 "use gnulib module aligned_alloc for portability");
330 /* Parse a signed decimal integer.
331 Returns the value of the integer. Errors are not detected. */
333 _GL_FUNCDECL_SYS (atoll
, long long, (const char *string
)
335 _GL_ARG_NONNULL ((1)));
337 _GL_CXXALIAS_SYS (atoll
, long long, (const char *string
));
338 _GL_CXXALIASWARN (atoll
);
339 #elif defined GNULIB_POSIXCHECK
341 # if HAVE_RAW_DECL_ATOLL
342 _GL_WARN_ON_USE (atoll
, "atoll is unportable - "
343 "use gnulib module atoll for portability");
347 #if @GNULIB_CALLOC_POSIX@
348 # if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
349 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
350 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
352 # define calloc rpl_calloc
354 _GL_FUNCDECL_RPL (calloc
, void *,
355 (size_t nmemb
, size_t size
)
356 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
357 _GL_CXXALIAS_RPL (calloc
, void *, (size_t nmemb
, size_t size
));
360 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
361 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
362 _GL_FUNCDECL_SYS (calloc
, void *,
363 (size_t nmemb
, size_t size
)
364 _GL_ATTRIBUTE_NOTHROW
365 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
367 _GL_FUNCDECL_SYS (calloc
, void *,
368 (size_t nmemb
, size_t size
)
369 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
372 _GL_CXXALIAS_SYS (calloc
, void *, (size_t nmemb
, size_t size
));
375 _GL_CXXALIASWARN (calloc
);
378 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc
379 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
380 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
381 _GL_FUNCDECL_SYS (calloc
, void *,
382 (size_t nmemb
, size_t size
)
383 _GL_ATTRIBUTE_NOTHROW
384 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
386 _GL_FUNCDECL_SYS (calloc
, void *,
387 (size_t nmemb
, size_t size
)
388 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
391 # if defined GNULIB_POSIXCHECK
393 /* Assume calloc is always declared. */
394 _GL_WARN_ON_USE (calloc
, "calloc is not POSIX compliant everywhere - "
395 "use gnulib module calloc-posix for portability");
399 #if @GNULIB_CANONICALIZE_FILE_NAME@
400 # if @REPLACE_CANONICALIZE_FILE_NAME@
401 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
402 # define canonicalize_file_name rpl_canonicalize_file_name
404 _GL_FUNCDECL_RPL (canonicalize_file_name
, char *,
406 _GL_ARG_NONNULL ((1))
407 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
408 _GL_CXXALIAS_RPL (canonicalize_file_name
, char *, (const char *name
));
410 # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
411 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
412 _GL_FUNCDECL_SYS (canonicalize_file_name
, char *,
414 _GL_ATTRIBUTE_NOTHROW
415 _GL_ARG_NONNULL ((1))
416 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
418 _GL_FUNCDECL_SYS (canonicalize_file_name
, char *,
420 _GL_ARG_NONNULL ((1))
421 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
424 _GL_CXXALIAS_SYS (canonicalize_file_name
, char *, (const char *name
));
426 # ifndef GNULIB_defined_canonicalize_file_name
427 # define GNULIB_defined_canonicalize_file_name \
428 (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
430 _GL_CXXALIASWARN (canonicalize_file_name
);
432 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
433 /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
435 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
436 _GL_FUNCDECL_SYS (canonicalize_file_name
, char *,
438 _GL_ATTRIBUTE_NOTHROW
439 _GL_ARG_NONNULL ((1))
440 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
442 _GL_FUNCDECL_SYS (canonicalize_file_name
, char *,
444 _GL_ARG_NONNULL ((1))
445 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
448 # if defined GNULIB_POSIXCHECK
449 # undef canonicalize_file_name
450 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
451 _GL_WARN_ON_USE (canonicalize_file_name
,
452 "canonicalize_file_name is unportable - "
453 "use gnulib module canonicalize-lgpl for portability");
458 #if @GNULIB_MDA_ECVT@
459 /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
460 required. In C++ with GNULIB_NAMESPACE, avoid differences between
461 platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
463 # if defined _WIN32 && !defined __CYGWIN__
464 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
468 _GL_CXXALIAS_MDA (ecvt
, char *,
469 (double number
, int ndigits
, int *decptp
, int *signp
));
471 # if @HAVE_DECL_ECVT@
472 _GL_CXXALIAS_SYS (ecvt
, char *,
473 (double number
, int ndigits
, int *decptp
, int *signp
));
476 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
477 _GL_CXXALIASWARN (ecvt
);
481 #if @GNULIB_MDA_FCVT@
482 /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
483 required. In C++ with GNULIB_NAMESPACE, avoid differences between
484 platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
486 # if defined _WIN32 && !defined __CYGWIN__
487 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
491 _GL_CXXALIAS_MDA (fcvt
, char *,
492 (double number
, int ndigits
, int *decptp
, int *signp
));
494 # if @HAVE_DECL_FCVT@
495 _GL_CXXALIAS_SYS (fcvt
, char *,
496 (double number
, int ndigits
, int *decptp
, int *signp
));
499 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
500 _GL_CXXALIASWARN (fcvt
);
504 #if @GNULIB_MDA_GCVT@
505 /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
506 required. In C++ with GNULIB_NAMESPACE, avoid differences between
507 platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
509 # if defined _WIN32 && !defined __CYGWIN__
510 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
514 _GL_CXXALIAS_MDA (gcvt
, char *, (double number
, int ndigits
, char *buf
));
516 # if @HAVE_DECL_GCVT@
517 _GL_CXXALIAS_SYS (gcvt
, char *, (double number
, int ndigits
, char *buf
));
520 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
521 _GL_CXXALIASWARN (gcvt
);
525 #if @GNULIB_GETLOADAVG@
526 /* Store max(NELEM,3) load average numbers in LOADAVG[].
527 The three numbers are the load average of the last 1 minute, the last 5
528 minutes, and the last 15 minutes, respectively.
529 LOADAVG is an array of NELEM numbers. */
530 # if @REPLACE_GETLOADAVG@
531 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
533 # define getloadavg rpl_getloadavg
535 _GL_FUNCDECL_RPL (getloadavg
, int, (double loadavg
[], int nelem
)
536 _GL_ARG_NONNULL ((1)));
537 _GL_CXXALIAS_RPL (getloadavg
, int, (double loadavg
[], int nelem
));
539 # if !@HAVE_DECL_GETLOADAVG@
540 _GL_FUNCDECL_SYS (getloadavg
, int, (double loadavg
[], int nelem
)
541 _GL_ARG_NONNULL ((1)));
543 _GL_CXXALIAS_SYS (getloadavg
, int, (double loadavg
[], int nelem
));
546 _GL_CXXALIASWARN (getloadavg
);
548 #elif defined GNULIB_POSIXCHECK
550 # if HAVE_RAW_DECL_GETLOADAVG
551 _GL_WARN_ON_USE (getloadavg
, "getloadavg is not portable - "
552 "use gnulib module getloadavg for portability");
556 #if @GNULIB_GETPROGNAME@
557 /* Return the base name of the executing program.
558 On native Windows this will usually end in ".exe" or ".EXE". */
559 # if @REPLACE_GETPROGNAME@
560 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
562 # define getprogname rpl_getprogname
564 # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
565 _GL_FUNCDECL_RPL (getprogname
, const char *, (void) _GL_ATTRIBUTE_PURE
);
567 _GL_FUNCDECL_RPL (getprogname
, const char *, (void));
569 _GL_CXXALIAS_RPL (getprogname
, const char *, (void));
571 # if !@HAVE_GETPROGNAME@
572 # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
573 _GL_FUNCDECL_SYS (getprogname
, const char *, (void) _GL_ATTRIBUTE_PURE
);
575 _GL_FUNCDECL_SYS (getprogname
, const char *, (void));
578 _GL_CXXALIAS_SYS (getprogname
, const char *, (void));
581 _GL_CXXALIASWARN (getprogname
);
583 #elif defined GNULIB_POSIXCHECK
585 # if HAVE_RAW_DECL_GETPROGNAME
586 _GL_WARN_ON_USE (getprogname
, "getprogname is unportable - "
587 "use gnulib module getprogname for portability");
591 #if @GNULIB_GETSUBOPT@
592 /* Assuming *OPTIONP is a comma separated list of elements of the form
593 "token" or "token=value", getsubopt parses the first of these elements.
594 If the first element refers to a "token" that is member of the given
595 NULL-terminated array of tokens:
596 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
597 the first option and the comma, sets *VALUEP to the value of the
598 element (or NULL if it doesn't contain an "=" sign),
599 - It returns the index of the "token" in the given array of tokens.
600 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
601 For more details see the POSIX specification.
602 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
603 # if @REPLACE_GETSUBOPT@
604 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
606 # define getsubopt rpl_getsubopt
608 _GL_FUNCDECL_RPL (getsubopt
, int,
609 (char **optionp
, char *const *tokens
, char **valuep
)
610 _GL_ARG_NONNULL ((1, 2, 3)));
611 _GL_CXXALIAS_RPL (getsubopt
, int,
612 (char **optionp
, char *const *tokens
, char **valuep
));
614 # if !@HAVE_GETSUBOPT@
615 _GL_FUNCDECL_SYS (getsubopt
, int,
616 (char **optionp
, char *const *tokens
, char **valuep
)
617 _GL_ARG_NONNULL ((1, 2, 3)));
619 _GL_CXXALIAS_SYS (getsubopt
, int,
620 (char **optionp
, char *const *tokens
, char **valuep
));
623 _GL_CXXALIASWARN (getsubopt
);
625 #elif defined GNULIB_POSIXCHECK
627 # if HAVE_RAW_DECL_GETSUBOPT
628 _GL_WARN_ON_USE (getsubopt
, "getsubopt is unportable - "
629 "use gnulib module getsubopt for portability");
634 /* Change the ownership and access permission of the slave side of the
635 pseudo-terminal whose master side is specified by FD. */
637 _GL_FUNCDECL_SYS (grantpt
, int, (int fd
));
639 _GL_CXXALIAS_SYS (grantpt
, int, (int fd
));
640 _GL_CXXALIASWARN (grantpt
);
641 #elif defined GNULIB_POSIXCHECK
643 # if HAVE_RAW_DECL_GRANTPT
644 _GL_WARN_ON_USE (grantpt
, "grantpt is not portable - "
645 "use gnulib module grantpt for portability");
649 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
650 rely on GNU or POSIX semantics for malloc and realloc (for example,
651 by never specifying a zero size), so it does not need malloc or
652 realloc to be redefined. */
653 #if @GNULIB_MALLOC_POSIX@
654 # if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
655 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
656 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
657 || _GL_USE_STDLIB_ALLOC)
659 # define malloc rpl_malloc
661 _GL_FUNCDECL_RPL (malloc
, void *,
663 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
664 _GL_CXXALIAS_RPL (malloc
, void *, (size_t size
));
667 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
668 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
669 _GL_FUNCDECL_SYS (malloc
, void *,
671 _GL_ATTRIBUTE_NOTHROW
672 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
674 _GL_FUNCDECL_SYS (malloc
, void *,
676 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
679 _GL_CXXALIAS_SYS (malloc
, void *, (size_t size
));
682 _GL_CXXALIASWARN (malloc
);
685 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc
686 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
687 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
688 _GL_FUNCDECL_SYS (malloc
, void *,
690 _GL_ATTRIBUTE_NOTHROW
691 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
693 _GL_FUNCDECL_SYS (malloc
, void *,
695 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
698 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
700 /* Assume malloc is always declared. */
701 _GL_WARN_ON_USE (malloc
, "malloc is not POSIX compliant everywhere - "
702 "use gnulib module malloc-posix for portability");
706 /* Return maximum number of bytes of a multibyte character. */
707 #if @REPLACE_MB_CUR_MAX@
708 # if !GNULIB_defined_MB_CUR_MAX
710 int gl_MB_CUR_MAX (void)
712 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */
713 return MB_CUR_MAX
+ (MB_CUR_MAX
== 3);
716 # define MB_CUR_MAX gl_MB_CUR_MAX ()
717 # define GNULIB_defined_MB_CUR_MAX 1
721 /* Convert a string to a wide string. */
722 #if @GNULIB_MBSTOWCS@
723 # if @REPLACE_MBSTOWCS@
724 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
726 # define mbstowcs rpl_mbstowcs
728 _GL_FUNCDECL_RPL (mbstowcs
, size_t,
729 (wchar_t *restrict dest
, const char *restrict src
,
731 _GL_ARG_NONNULL ((2)));
732 _GL_CXXALIAS_RPL (mbstowcs
, size_t,
733 (wchar_t *restrict dest
, const char *restrict src
,
736 _GL_CXXALIAS_SYS (mbstowcs
, size_t,
737 (wchar_t *restrict dest
, const char *restrict src
,
741 _GL_CXXALIASWARN (mbstowcs
);
743 #elif defined GNULIB_POSIXCHECK
745 # if HAVE_RAW_DECL_MBSTOWCS
746 _GL_WARN_ON_USE (mbstowcs
, "mbstowcs is unportable - "
747 "use gnulib module mbstowcs for portability");
751 /* Convert a multibyte character to a wide character. */
753 # if @REPLACE_MBTOWC@
754 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
756 # define mbtowc rpl_mbtowc
758 _GL_FUNCDECL_RPL (mbtowc
, int,
759 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
760 _GL_CXXALIAS_RPL (mbtowc
, int,
761 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
764 _GL_FUNCDECL_SYS (mbtowc
, int,
765 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
767 _GL_CXXALIAS_SYS (mbtowc
, int,
768 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
771 _GL_CXXALIASWARN (mbtowc
);
773 #elif defined GNULIB_POSIXCHECK
775 # if HAVE_RAW_DECL_MBTOWC
776 _GL_WARN_ON_USE (mbtowc
, "mbtowc is not portable - "
777 "use gnulib module mbtowc for portability");
782 /* Create a unique temporary directory from TEMPLATE.
783 The last six characters of TEMPLATE must be "XXXXXX";
784 they are replaced with a string that makes the directory name unique.
785 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
786 The directory is created mode 700. */
788 _GL_FUNCDECL_SYS (mkdtemp
, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
790 _GL_CXXALIAS_SYS (mkdtemp
, char *, (char * /*template*/));
791 _GL_CXXALIASWARN (mkdtemp
);
792 #elif defined GNULIB_POSIXCHECK
794 # if HAVE_RAW_DECL_MKDTEMP
795 _GL_WARN_ON_USE (mkdtemp
, "mkdtemp is unportable - "
796 "use gnulib module mkdtemp for portability");
800 #if @GNULIB_MKOSTEMP@
801 /* Create a unique temporary file from TEMPLATE.
802 The last six characters of TEMPLATE must be "XXXXXX";
803 they are replaced with a string that makes the file name unique.
804 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
805 and O_TEXT, O_BINARY (defined in "binary-io.h").
806 The file is then created, with the specified flags, ensuring it didn't exist
808 The file is created read-write (mask at least 0600 & ~umask), but it may be
809 world-readable and world-writable (mask 0666 & ~umask), depending on the
811 Returns the open file descriptor if successful, otherwise -1 and errno
813 # if @REPLACE_MKOSTEMP@
814 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
816 # define mkostemp rpl_mkostemp
818 _GL_FUNCDECL_RPL (mkostemp
, int, (char * /*template*/, int /*flags*/)
819 _GL_ARG_NONNULL ((1)));
820 _GL_CXXALIAS_RPL (mkostemp
, int, (char * /*template*/, int /*flags*/));
822 # if !@HAVE_MKOSTEMP@
823 _GL_FUNCDECL_SYS (mkostemp
, int, (char * /*template*/, int /*flags*/)
824 _GL_ARG_NONNULL ((1)));
826 _GL_CXXALIAS_SYS (mkostemp
, int, (char * /*template*/, int /*flags*/));
829 _GL_CXXALIASWARN (mkostemp
);
831 #elif defined GNULIB_POSIXCHECK
833 # if HAVE_RAW_DECL_MKOSTEMP
834 _GL_WARN_ON_USE (mkostemp
, "mkostemp is unportable - "
835 "use gnulib module mkostemp for portability");
839 #if @GNULIB_MKOSTEMPS@
840 /* Create a unique temporary file from TEMPLATE.
841 The last six characters of TEMPLATE before a suffix of length
842 SUFFIXLEN must be "XXXXXX";
843 they are replaced with a string that makes the file name unique.
844 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
845 and O_TEXT, O_BINARY (defined in "binary-io.h").
846 The file is then created, with the specified flags, ensuring it didn't exist
848 The file is created read-write (mask at least 0600 & ~umask), but it may be
849 world-readable and world-writable (mask 0666 & ~umask), depending on the
851 Returns the open file descriptor if successful, otherwise -1 and errno
853 # if @REPLACE_MKOSTEMPS@
854 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
856 # define mkostemps rpl_mkostemps
858 _GL_FUNCDECL_RPL (mkostemps
, int,
859 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
860 _GL_ARG_NONNULL ((1)));
861 _GL_CXXALIAS_RPL (mkostemps
, int,
862 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
864 # if !@HAVE_MKOSTEMPS@
865 _GL_FUNCDECL_SYS (mkostemps
, int,
866 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
867 _GL_ARG_NONNULL ((1)));
869 _GL_CXXALIAS_SYS (mkostemps
, int,
870 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
873 _GL_CXXALIASWARN (mkostemps
);
875 #elif defined GNULIB_POSIXCHECK
877 # if HAVE_RAW_DECL_MKOSTEMPS
878 _GL_WARN_ON_USE (mkostemps
, "mkostemps is unportable - "
879 "use gnulib module mkostemps for portability");
884 /* Create a unique temporary file from TEMPLATE.
885 The last six characters of TEMPLATE must be "XXXXXX";
886 they are replaced with a string that makes the file name unique.
887 The file is then created, ensuring it didn't exist before.
888 The file is created read-write (mask at least 0600 & ~umask), but it may be
889 world-readable and world-writable (mask 0666 & ~umask), depending on the
891 Returns the open file descriptor if successful, otherwise -1 and errno
893 # if @REPLACE_MKSTEMP@
894 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
895 # define mkstemp rpl_mkstemp
897 _GL_FUNCDECL_RPL (mkstemp
, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
898 _GL_CXXALIAS_RPL (mkstemp
, int, (char * /*template*/));
900 # if ! @HAVE_MKSTEMP@
901 _GL_FUNCDECL_SYS (mkstemp
, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
903 _GL_CXXALIAS_SYS (mkstemp
, int, (char * /*template*/));
905 _GL_CXXALIASWARN (mkstemp
);
906 #elif defined GNULIB_POSIXCHECK
908 # if HAVE_RAW_DECL_MKSTEMP
909 _GL_WARN_ON_USE (mkstemp
, "mkstemp is unportable - "
910 "use gnulib module mkstemp for portability");
914 #if @GNULIB_MKSTEMPS@
915 /* Create a unique temporary file from TEMPLATE.
916 The last six characters of TEMPLATE prior to a suffix of length
917 SUFFIXLEN must be "XXXXXX";
918 they are replaced with a string that makes the file name unique.
919 The file is then created, ensuring it didn't exist before.
920 The file is created read-write (mask at least 0600 & ~umask), but it may be
921 world-readable and world-writable (mask 0666 & ~umask), depending on the
923 Returns the open file descriptor if successful, otherwise -1 and errno
925 # if !@HAVE_MKSTEMPS@
926 _GL_FUNCDECL_SYS (mkstemps
, int, (char * /*template*/, int /*suffixlen*/)
927 _GL_ARG_NONNULL ((1)));
929 _GL_CXXALIAS_SYS (mkstemps
, int, (char * /*template*/, int /*suffixlen*/));
930 _GL_CXXALIASWARN (mkstemps
);
931 #elif defined GNULIB_POSIXCHECK
933 # if HAVE_RAW_DECL_MKSTEMPS
934 _GL_WARN_ON_USE (mkstemps
, "mkstemps is unportable - "
935 "use gnulib module mkstemps for portability");
939 #if @GNULIB_MDA_MKTEMP@
940 /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
941 required. In C++ with GNULIB_NAMESPACE, avoid differences between
942 platforms by defining GNULIB_NAMESPACE::mktemp always. */
943 # if defined _WIN32 && !defined __CYGWIN__
944 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
946 # define mktemp _mktemp
948 _GL_CXXALIAS_MDA (mktemp
, char *, (char * /*template*/));
950 _GL_CXXALIAS_SYS (mktemp
, char *, (char * /*template*/));
952 _GL_CXXALIASWARN (mktemp
);
955 /* Allocate memory with indefinite extent and specified alignment. */
956 #if @GNULIB_POSIX_MEMALIGN@
957 # if @REPLACE_POSIX_MEMALIGN@
958 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
959 # undef posix_memalign
960 # define posix_memalign rpl_posix_memalign
962 _GL_FUNCDECL_RPL (posix_memalign
, int,
963 (void **memptr
, size_t alignment
, size_t size
)
964 _GL_ARG_NONNULL ((1)));
965 _GL_CXXALIAS_RPL (posix_memalign
, int,
966 (void **memptr
, size_t alignment
, size_t size
));
968 # if @HAVE_POSIX_MEMALIGN@
969 _GL_CXXALIAS_SYS (posix_memalign
, int,
970 (void **memptr
, size_t alignment
, size_t size
));
973 # if __GLIBC__ >= 2 && @HAVE_POSIX_MEMALIGN@
974 _GL_CXXALIASWARN (posix_memalign
);
976 #elif defined GNULIB_POSIXCHECK
977 # undef posix_memalign
978 # if HAVE_RAW_DECL_POSIX_MEMALIGN
979 _GL_WARN_ON_USE (posix_memalign
, "posix_memalign is not portable - "
980 "use gnulib module posix_memalign for portability");
984 #if @GNULIB_POSIX_OPENPT@
985 /* Return an FD open to the master side of a pseudo-terminal. Flags should
986 include O_RDWR, and may also include O_NOCTTY. */
987 # if @REPLACE_POSIX_OPENPT@
988 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
990 # define posix_openpt rpl_posix_openpt
992 _GL_FUNCDECL_RPL (posix_openpt
, int, (int flags
));
993 _GL_CXXALIAS_RPL (posix_openpt
, int, (int flags
));
995 # if !@HAVE_POSIX_OPENPT@
996 _GL_FUNCDECL_SYS (posix_openpt
, int, (int flags
));
998 _GL_CXXALIAS_SYS (posix_openpt
, int, (int flags
));
1001 _GL_CXXALIASWARN (posix_openpt
);
1003 #elif defined GNULIB_POSIXCHECK
1004 # undef posix_openpt
1005 # if HAVE_RAW_DECL_POSIX_OPENPT
1006 _GL_WARN_ON_USE (posix_openpt
, "posix_openpt is not portable - "
1007 "use gnulib module posix_openpt for portability");
1011 #if @GNULIB_PTSNAME@
1012 /* Return the pathname of the pseudo-terminal slave associated with
1013 the master FD is open on, or NULL on errors. */
1014 # if @REPLACE_PTSNAME@
1015 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1017 # define ptsname rpl_ptsname
1019 _GL_FUNCDECL_RPL (ptsname
, char *, (int fd
));
1020 _GL_CXXALIAS_RPL (ptsname
, char *, (int fd
));
1022 # if !@HAVE_PTSNAME@
1023 _GL_FUNCDECL_SYS (ptsname
, char *, (int fd
));
1025 _GL_CXXALIAS_SYS (ptsname
, char *, (int fd
));
1027 _GL_CXXALIASWARN (ptsname
);
1028 #elif defined GNULIB_POSIXCHECK
1030 # if HAVE_RAW_DECL_PTSNAME
1031 _GL_WARN_ON_USE (ptsname
, "ptsname is not portable - "
1032 "use gnulib module ptsname for portability");
1036 #if @GNULIB_PTSNAME_R@
1037 /* Set the pathname of the pseudo-terminal slave associated with
1038 the master FD is open on and return 0, or set errno and return
1039 non-zero on errors. */
1040 # if @REPLACE_PTSNAME_R@
1041 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1043 # define ptsname_r rpl_ptsname_r
1045 _GL_FUNCDECL_RPL (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
1046 _GL_CXXALIAS_RPL (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
1048 # if !@HAVE_PTSNAME_R@
1049 _GL_FUNCDECL_SYS (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
1051 _GL_CXXALIAS_SYS (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
1053 # ifndef GNULIB_defined_ptsname_r
1054 # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
1056 _GL_CXXALIASWARN (ptsname_r
);
1057 #elif defined GNULIB_POSIXCHECK
1059 # if HAVE_RAW_DECL_PTSNAME_R
1060 _GL_WARN_ON_USE (ptsname_r
, "ptsname_r is not portable - "
1061 "use gnulib module ptsname_r for portability");
1066 # if @REPLACE_PUTENV@
1067 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1069 # define putenv rpl_putenv
1071 _GL_FUNCDECL_RPL (putenv
, int, (char *string
) _GL_ARG_NONNULL ((1)));
1072 _GL_CXXALIAS_RPL (putenv
, int, (char *string
));
1073 # elif defined _WIN32 && !defined __CYGWIN__
1074 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1076 # define putenv _putenv
1078 _GL_CXXALIAS_MDA (putenv
, int, (char *string
));
1079 # elif defined __KLIBC__
1080 /* Need to cast, because on OS/2 kLIBC, the first parameter is
1081 const char *string. */
1082 _GL_CXXALIAS_SYS_CAST (putenv
, int, (char *string
));
1084 _GL_CXXALIAS_SYS (putenv
, int, (char *string
));
1086 _GL_CXXALIASWARN (putenv
);
1087 #elif @GNULIB_MDA_PUTENV@
1088 /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
1089 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1090 platforms by defining GNULIB_NAMESPACE::putenv always. */
1091 # if defined _WIN32 && !defined __CYGWIN__
1092 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1094 # define putenv _putenv
1096 /* Need to cast, because on mingw, the parameter is either
1097 'const char *string' or 'char *string'. */
1098 _GL_CXXALIAS_MDA_CAST (putenv
, int, (char *string
));
1099 # elif defined __KLIBC__
1100 /* Need to cast, because on OS/2 kLIBC, the first parameter is
1101 const char *string. */
1102 _GL_CXXALIAS_SYS_CAST (putenv
, int, (char *string
));
1104 _GL_CXXALIAS_SYS (putenv
, int, (char *string
));
1106 _GL_CXXALIASWARN (putenv
);
1109 #if @GNULIB_QSORT_R@
1110 /* Sort an array of NMEMB elements, starting at address BASE, each element
1111 occupying SIZE bytes, in ascending order according to the comparison
1112 function COMPARE. */
1116 # if !GNULIB_defined_qsort_r_fn_types
1117 typedef int (*_gl_qsort_r_compar_fn
) (void const *, void const *, void *);
1118 # define GNULIB_defined_qsort_r_fn_types 1
1123 # if @REPLACE_QSORT_R@
1124 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1126 # define qsort_r rpl_qsort_r
1128 _GL_FUNCDECL_RPL (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
1129 _gl_qsort_r_compar_fn compare
,
1130 void *arg
) _GL_ARG_NONNULL ((1, 4)));
1131 _GL_CXXALIAS_RPL (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
1132 _gl_qsort_r_compar_fn compare
,
1135 # if !@HAVE_QSORT_R@
1136 _GL_FUNCDECL_SYS (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
1137 _gl_qsort_r_compar_fn compare
,
1138 void *arg
) _GL_ARG_NONNULL ((1, 4)));
1140 _GL_CXXALIAS_SYS (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
1141 _gl_qsort_r_compar_fn compare
,
1145 _GL_CXXALIASWARN (qsort_r
);
1147 #elif defined GNULIB_POSIXCHECK
1149 # if HAVE_RAW_DECL_QSORT_R
1150 _GL_WARN_ON_USE (qsort_r
, "qsort_r is not portable - "
1151 "use gnulib module qsort_r for portability");
1156 #if @GNULIB_RAND@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@)
1158 # define RAND_MAX 2147483647
1165 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1167 # define rand rpl_rand
1169 _GL_FUNCDECL_RPL (rand
, int, (void));
1170 _GL_CXXALIAS_RPL (rand
, int, (void));
1172 _GL_CXXALIAS_SYS (rand
, int, (void));
1175 _GL_CXXALIASWARN (rand
);
1181 # if @REPLACE_RANDOM@
1182 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1184 # define random rpl_random
1186 _GL_FUNCDECL_RPL (random
, long, (void));
1187 _GL_CXXALIAS_RPL (random
, long, (void));
1190 _GL_FUNCDECL_SYS (random
, long, (void));
1192 /* Need to cast, because on Haiku, the return type is
1194 _GL_CXXALIAS_SYS_CAST (random
, long, (void));
1197 _GL_CXXALIASWARN (random
);
1199 #elif defined GNULIB_POSIXCHECK
1201 # if HAVE_RAW_DECL_RANDOM
1202 _GL_WARN_ON_USE (random
, "random is unportable - "
1203 "use gnulib module random for portability");
1208 # if @REPLACE_RANDOM@
1209 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1211 # define srandom rpl_srandom
1213 _GL_FUNCDECL_RPL (srandom
, void, (unsigned int seed
));
1214 _GL_CXXALIAS_RPL (srandom
, void, (unsigned int seed
));
1217 _GL_FUNCDECL_SYS (srandom
, void, (unsigned int seed
));
1219 /* Need to cast, because on FreeBSD, the first parameter is
1220 unsigned long seed. */
1221 _GL_CXXALIAS_SYS_CAST (srandom
, void, (unsigned int seed
));
1224 _GL_CXXALIASWARN (srandom
);
1226 #elif defined GNULIB_POSIXCHECK
1228 # if HAVE_RAW_DECL_SRANDOM
1229 _GL_WARN_ON_USE (srandom
, "srandom is unportable - "
1230 "use gnulib module random for portability");
1235 # if @REPLACE_INITSTATE@
1236 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1238 # define initstate rpl_initstate
1240 _GL_FUNCDECL_RPL (initstate
, char *,
1241 (unsigned int seed
, char *buf
, size_t buf_size
)
1242 _GL_ARG_NONNULL ((2)));
1243 _GL_CXXALIAS_RPL (initstate
, char *,
1244 (unsigned int seed
, char *buf
, size_t buf_size
));
1246 # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
1247 _GL_FUNCDECL_SYS (initstate
, char *,
1248 (unsigned int seed
, char *buf
, size_t buf_size
)
1249 _GL_ARG_NONNULL ((2)));
1251 /* Need to cast, because on FreeBSD, the first parameter is
1252 unsigned long seed. */
1253 _GL_CXXALIAS_SYS_CAST (initstate
, char *,
1254 (unsigned int seed
, char *buf
, size_t buf_size
));
1257 _GL_CXXALIASWARN (initstate
);
1259 #elif defined GNULIB_POSIXCHECK
1261 # if HAVE_RAW_DECL_INITSTATE
1262 _GL_WARN_ON_USE (initstate
, "initstate is unportable - "
1263 "use gnulib module random for portability");
1268 # if @REPLACE_SETSTATE@
1269 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1271 # define setstate rpl_setstate
1273 _GL_FUNCDECL_RPL (setstate
, char *, (char *arg_state
) _GL_ARG_NONNULL ((1)));
1274 _GL_CXXALIAS_RPL (setstate
, char *, (char *arg_state
));
1276 # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
1277 _GL_FUNCDECL_SYS (setstate
, char *, (char *arg_state
) _GL_ARG_NONNULL ((1)));
1279 /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
1280 is const char *arg_state. */
1281 _GL_CXXALIAS_SYS_CAST (setstate
, char *, (char *arg_state
));
1284 _GL_CXXALIASWARN (setstate
);
1286 #elif defined GNULIB_POSIXCHECK
1288 # if HAVE_RAW_DECL_SETSTATE
1289 _GL_WARN_ON_USE (setstate
, "setstate is unportable - "
1290 "use gnulib module random for portability");
1295 #if @GNULIB_RANDOM_R@
1296 # if @REPLACE_RANDOM_R@
1297 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1299 # define random_r rpl_random_r
1301 _GL_FUNCDECL_RPL (random_r
, int, (struct random_data
*buf
, int32_t *result
)
1302 _GL_ARG_NONNULL ((1, 2)));
1303 _GL_CXXALIAS_RPL (random_r
, int, (struct random_data
*buf
, int32_t *result
));
1305 # if !@HAVE_RANDOM_R@
1306 _GL_FUNCDECL_SYS (random_r
, int, (struct random_data
*buf
, int32_t *result
)
1307 _GL_ARG_NONNULL ((1, 2)));
1309 _GL_CXXALIAS_SYS (random_r
, int, (struct random_data
*buf
, int32_t *result
));
1311 _GL_CXXALIASWARN (random_r
);
1312 #elif defined GNULIB_POSIXCHECK
1314 # if HAVE_RAW_DECL_RANDOM_R
1315 _GL_WARN_ON_USE (random_r
, "random_r is unportable - "
1316 "use gnulib module random_r for portability");
1320 #if @GNULIB_RANDOM_R@
1321 # if @REPLACE_RANDOM_R@
1322 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1324 # define srandom_r rpl_srandom_r
1326 _GL_FUNCDECL_RPL (srandom_r
, int,
1327 (unsigned int seed
, struct random_data
*rand_state
)
1328 _GL_ARG_NONNULL ((2)));
1329 _GL_CXXALIAS_RPL (srandom_r
, int,
1330 (unsigned int seed
, struct random_data
*rand_state
));
1332 # if !@HAVE_RANDOM_R@
1333 _GL_FUNCDECL_SYS (srandom_r
, int,
1334 (unsigned int seed
, struct random_data
*rand_state
)
1335 _GL_ARG_NONNULL ((2)));
1337 _GL_CXXALIAS_SYS (srandom_r
, int,
1338 (unsigned int seed
, struct random_data
*rand_state
));
1340 _GL_CXXALIASWARN (srandom_r
);
1341 #elif defined GNULIB_POSIXCHECK
1343 # if HAVE_RAW_DECL_SRANDOM_R
1344 _GL_WARN_ON_USE (srandom_r
, "srandom_r is unportable - "
1345 "use gnulib module random_r for portability");
1349 #if @GNULIB_RANDOM_R@
1350 # if @REPLACE_RANDOM_R@
1351 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1353 # define initstate_r rpl_initstate_r
1355 _GL_FUNCDECL_RPL (initstate_r
, int,
1356 (unsigned int seed
, char *buf
, size_t buf_size
,
1357 struct random_data
*rand_state
)
1358 _GL_ARG_NONNULL ((2, 4)));
1359 _GL_CXXALIAS_RPL (initstate_r
, int,
1360 (unsigned int seed
, char *buf
, size_t buf_size
,
1361 struct random_data
*rand_state
));
1363 # if !@HAVE_RANDOM_R@
1364 _GL_FUNCDECL_SYS (initstate_r
, int,
1365 (unsigned int seed
, char *buf
, size_t buf_size
,
1366 struct random_data
*rand_state
)
1367 _GL_ARG_NONNULL ((2, 4)));
1369 /* Need to cast, because on Haiku, the third parameter is
1370 unsigned long buf_size. */
1371 _GL_CXXALIAS_SYS_CAST (initstate_r
, int,
1372 (unsigned int seed
, char *buf
, size_t buf_size
,
1373 struct random_data
*rand_state
));
1375 _GL_CXXALIASWARN (initstate_r
);
1376 #elif defined GNULIB_POSIXCHECK
1378 # if HAVE_RAW_DECL_INITSTATE_R
1379 _GL_WARN_ON_USE (initstate_r
, "initstate_r is unportable - "
1380 "use gnulib module random_r for portability");
1384 #if @GNULIB_RANDOM_R@
1385 # if @REPLACE_RANDOM_R@
1386 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1388 # define setstate_r rpl_setstate_r
1390 _GL_FUNCDECL_RPL (setstate_r
, int,
1391 (char *arg_state
, struct random_data
*rand_state
)
1392 _GL_ARG_NONNULL ((1, 2)));
1393 _GL_CXXALIAS_RPL (setstate_r
, int,
1394 (char *arg_state
, struct random_data
*rand_state
));
1396 # if !@HAVE_RANDOM_R@
1397 _GL_FUNCDECL_SYS (setstate_r
, int,
1398 (char *arg_state
, struct random_data
*rand_state
)
1399 _GL_ARG_NONNULL ((1, 2)));
1401 /* Need to cast, because on Haiku, the first parameter is
1403 _GL_CXXALIAS_SYS_CAST (setstate_r
, int,
1404 (char *arg_state
, struct random_data
*rand_state
));
1406 _GL_CXXALIASWARN (setstate_r
);
1407 #elif defined GNULIB_POSIXCHECK
1409 # if HAVE_RAW_DECL_SETSTATE_R
1410 _GL_WARN_ON_USE (setstate_r
, "setstate_r is unportable - "
1411 "use gnulib module random_r for portability");
1416 #if @GNULIB_REALLOC_POSIX@
1417 # if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
1418 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
1419 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1420 || _GL_USE_STDLIB_ALLOC)
1422 # define realloc rpl_realloc
1424 _GL_FUNCDECL_RPL (realloc
, void *, (void *ptr
, size_t size
)
1425 _GL_ATTRIBUTE_DEALLOC_FREE
);
1426 _GL_CXXALIAS_RPL (realloc
, void *, (void *ptr
, size_t size
));
1429 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1430 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1431 _GL_FUNCDECL_SYS (realloc
, void *,
1432 (void *ptr
, size_t size
)
1433 _GL_ATTRIBUTE_NOTHROW
1434 _GL_ATTRIBUTE_DEALLOC_FREE
);
1436 _GL_FUNCDECL_SYS (realloc
, void *,
1437 (void *ptr
, size_t size
)
1438 _GL_ATTRIBUTE_DEALLOC_FREE
);
1441 _GL_CXXALIAS_SYS (realloc
, void *, (void *ptr
, size_t size
));
1444 _GL_CXXALIASWARN (realloc
);
1447 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
1448 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1449 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1450 _GL_FUNCDECL_SYS (realloc
, void *,
1451 (void *ptr
, size_t size
)
1452 _GL_ATTRIBUTE_NOTHROW
1453 _GL_ATTRIBUTE_DEALLOC_FREE
);
1455 _GL_FUNCDECL_SYS (realloc
, void *,
1456 (void *ptr
, size_t size
)
1457 _GL_ATTRIBUTE_DEALLOC_FREE
);
1460 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1462 /* Assume realloc is always declared. */
1463 _GL_WARN_ON_USE (realloc
, "realloc is not POSIX compliant everywhere - "
1464 "use gnulib module realloc-posix for portability");
1469 #if @GNULIB_REALLOCARRAY@
1470 # if @REPLACE_REALLOCARRAY@
1471 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1472 # undef reallocarray
1473 # define reallocarray rpl_reallocarray
1475 _GL_FUNCDECL_RPL (reallocarray
, void *,
1476 (void *ptr
, size_t nmemb
, size_t size
));
1477 _GL_CXXALIAS_RPL (reallocarray
, void *,
1478 (void *ptr
, size_t nmemb
, size_t size
));
1480 # if ! @HAVE_REALLOCARRAY@
1481 _GL_FUNCDECL_SYS (reallocarray
, void *,
1482 (void *ptr
, size_t nmemb
, size_t size
));
1484 _GL_CXXALIAS_SYS (reallocarray
, void *,
1485 (void *ptr
, size_t nmemb
, size_t size
));
1488 _GL_CXXALIASWARN (reallocarray
);
1490 #elif defined GNULIB_POSIXCHECK
1491 # undef reallocarray
1492 # if HAVE_RAW_DECL_REALLOCARRAY
1493 _GL_WARN_ON_USE (reallocarray
, "reallocarray is not portable - "
1494 "use gnulib module reallocarray for portability");
1498 #if @GNULIB_REALPATH@
1499 # if @REPLACE_REALPATH@
1500 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1501 # define realpath rpl_realpath
1503 _GL_FUNCDECL_RPL (realpath
, char *,
1504 (const char *restrict name
, char *restrict resolved
)
1505 _GL_ARG_NONNULL ((1)));
1506 _GL_CXXALIAS_RPL (realpath
, char *,
1507 (const char *restrict name
, char *restrict resolved
));
1509 # if !@HAVE_REALPATH@
1510 _GL_FUNCDECL_SYS (realpath
, char *,
1511 (const char *restrict name
, char *restrict resolved
)
1512 _GL_ARG_NONNULL ((1)));
1514 _GL_CXXALIAS_SYS (realpath
, char *,
1515 (const char *restrict name
, char *restrict resolved
));
1517 _GL_CXXALIASWARN (realpath
);
1518 #elif defined GNULIB_POSIXCHECK
1520 # if HAVE_RAW_DECL_REALPATH
1521 _GL_WARN_ON_USE (realpath
, "realpath is unportable - use gnulib module "
1522 "canonicalize or canonicalize-lgpl for portability");
1526 #if @GNULIB_RPMATCH@
1527 /* Test a user response to a question.
1528 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1529 # if !@HAVE_RPMATCH@
1530 _GL_FUNCDECL_SYS (rpmatch
, int, (const char *response
) _GL_ARG_NONNULL ((1)));
1532 _GL_CXXALIAS_SYS (rpmatch
, int, (const char *response
));
1533 _GL_CXXALIASWARN (rpmatch
);
1534 #elif defined GNULIB_POSIXCHECK
1536 # if HAVE_RAW_DECL_RPMATCH
1537 _GL_WARN_ON_USE (rpmatch
, "rpmatch is unportable - "
1538 "use gnulib module rpmatch for portability");
1542 #if @GNULIB_SECURE_GETENV@
1543 /* Look up NAME in the environment, returning 0 in insecure situations. */
1544 # if !@HAVE_SECURE_GETENV@
1545 _GL_FUNCDECL_SYS (secure_getenv
, char *,
1546 (char const *name
) _GL_ARG_NONNULL ((1)));
1548 _GL_CXXALIAS_SYS (secure_getenv
, char *, (char const *name
));
1549 _GL_CXXALIASWARN (secure_getenv
);
1550 #elif defined GNULIB_POSIXCHECK
1551 # undef secure_getenv
1552 # if HAVE_RAW_DECL_SECURE_GETENV
1553 _GL_WARN_ON_USE (secure_getenv
, "secure_getenv is unportable - "
1554 "use gnulib module secure_getenv for portability");
1559 /* Set NAME to VALUE in the environment.
1560 If REPLACE is nonzero, overwrite an existing value. */
1561 # if @REPLACE_SETENV@
1562 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1564 # define setenv rpl_setenv
1566 _GL_FUNCDECL_RPL (setenv
, int,
1567 (const char *name
, const char *value
, int replace
)
1568 _GL_ARG_NONNULL ((1)));
1569 _GL_CXXALIAS_RPL (setenv
, int,
1570 (const char *name
, const char *value
, int replace
));
1572 # if !@HAVE_DECL_SETENV@
1573 _GL_FUNCDECL_SYS (setenv
, int,
1574 (const char *name
, const char *value
, int replace
)
1575 _GL_ARG_NONNULL ((1)));
1577 _GL_CXXALIAS_SYS (setenv
, int,
1578 (const char *name
, const char *value
, int replace
));
1580 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
1581 _GL_CXXALIASWARN (setenv
);
1583 #elif defined GNULIB_POSIXCHECK
1585 # if HAVE_RAW_DECL_SETENV
1586 _GL_WARN_ON_USE (setenv
, "setenv is unportable - "
1587 "use gnulib module setenv for portability");
1592 /* Parse a double from STRING, updating ENDP if appropriate. */
1593 # if @REPLACE_STRTOD@
1594 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1595 # define strtod rpl_strtod
1597 # define GNULIB_defined_strtod_function 1
1598 _GL_FUNCDECL_RPL (strtod
, double,
1599 (const char *restrict str
, char **restrict endp
)
1600 _GL_ARG_NONNULL ((1)));
1601 _GL_CXXALIAS_RPL (strtod
, double,
1602 (const char *restrict str
, char **restrict endp
));
1605 _GL_FUNCDECL_SYS (strtod
, double,
1606 (const char *restrict str
, char **restrict endp
)
1607 _GL_ARG_NONNULL ((1)));
1609 _GL_CXXALIAS_SYS (strtod
, double,
1610 (const char *restrict str
, char **restrict endp
));
1613 _GL_CXXALIASWARN (strtod
);
1615 #elif defined GNULIB_POSIXCHECK
1617 # if HAVE_RAW_DECL_STRTOD
1618 _GL_WARN_ON_USE (strtod
, "strtod is unportable - "
1619 "use gnulib module strtod for portability");
1624 /* Parse a float from STRING, updating ENDP if appropriate. */
1625 # if @REPLACE_STRTOF@
1626 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1627 # define strtof rpl_strtof
1629 # define GNULIB_defined_strtof_function 1
1630 _GL_FUNCDECL_RPL (strtof
, float,
1631 (const char *restrict str
, char **restrict endp
)
1632 _GL_ARG_NONNULL ((1)));
1633 _GL_CXXALIAS_RPL (strtof
, float,
1634 (const char *restrict str
, char **restrict endp
));
1637 _GL_FUNCDECL_SYS (strtof
, float,
1638 (const char *restrict str
, char **restrict endp
)
1639 _GL_ARG_NONNULL ((1)));
1641 _GL_CXXALIAS_SYS (strtof
, float,
1642 (const char *restrict str
, char **restrict endp
));
1645 _GL_CXXALIASWARN (strtof
);
1647 #elif defined GNULIB_POSIXCHECK
1649 # if HAVE_RAW_DECL_STRTOF
1650 _GL_WARN_ON_USE (strtof
, "strtof is unportable - "
1651 "use gnulib module strtof for portability");
1655 #if @GNULIB_STRTOLD@
1656 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
1657 # if @REPLACE_STRTOLD@
1658 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1659 # define strtold rpl_strtold
1661 # define GNULIB_defined_strtold_function 1
1662 _GL_FUNCDECL_RPL (strtold
, long double,
1663 (const char *restrict str
, char **restrict endp
)
1664 _GL_ARG_NONNULL ((1)));
1665 _GL_CXXALIAS_RPL (strtold
, long double,
1666 (const char *restrict str
, char **restrict endp
));
1668 # if !@HAVE_STRTOLD@
1669 _GL_FUNCDECL_SYS (strtold
, long double,
1670 (const char *restrict str
, char **restrict endp
)
1671 _GL_ARG_NONNULL ((1)));
1673 _GL_CXXALIAS_SYS (strtold
, long double,
1674 (const char *restrict str
, char **restrict endp
));
1676 _GL_CXXALIASWARN (strtold
);
1677 #elif defined GNULIB_POSIXCHECK
1679 # if HAVE_RAW_DECL_STRTOLD
1680 _GL_WARN_ON_USE (strtold
, "strtold is unportable - "
1681 "use gnulib module strtold for portability");
1686 /* Parse a signed integer whose textual representation starts at STRING.
1687 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1688 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1690 If ENDPTR is not NULL, the address of the first byte after the integer is
1692 Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
1694 # if @REPLACE_STRTOL@
1695 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1696 # define strtol rpl_strtol
1698 # define GNULIB_defined_strtol_function 1
1699 _GL_FUNCDECL_RPL (strtol
, long,
1700 (const char *restrict string
, char **restrict endptr
,
1702 _GL_ARG_NONNULL ((1)));
1703 _GL_CXXALIAS_RPL (strtol
, long,
1704 (const char *restrict string
, char **restrict endptr
,
1708 _GL_FUNCDECL_SYS (strtol
, long,
1709 (const char *restrict string
, char **restrict endptr
,
1711 _GL_ARG_NONNULL ((1)));
1713 _GL_CXXALIAS_SYS (strtol
, long,
1714 (const char *restrict string
, char **restrict endptr
,
1718 _GL_CXXALIASWARN (strtol
);
1720 #elif defined GNULIB_POSIXCHECK
1722 # if HAVE_RAW_DECL_STRTOL
1723 _GL_WARN_ON_USE (strtol
, "strtol is unportable - "
1724 "use gnulib module strtol for portability");
1728 #if @GNULIB_STRTOLL@
1729 /* Parse a signed integer whose textual representation starts at STRING.
1730 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1731 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1733 If ENDPTR is not NULL, the address of the first byte after the integer is
1735 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
1737 # if @REPLACE_STRTOLL@
1738 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1739 # define strtoll rpl_strtoll
1741 # define GNULIB_defined_strtoll_function 1
1742 _GL_FUNCDECL_RPL (strtoll
, long long,
1743 (const char *restrict string
, char **restrict endptr
,
1745 _GL_ARG_NONNULL ((1)));
1746 _GL_CXXALIAS_RPL (strtoll
, long long,
1747 (const char *restrict string
, char **restrict endptr
,
1750 # if !@HAVE_STRTOLL@
1751 _GL_FUNCDECL_SYS (strtoll
, long long,
1752 (const char *restrict string
, char **restrict endptr
,
1754 _GL_ARG_NONNULL ((1)));
1756 _GL_CXXALIAS_SYS (strtoll
, long long,
1757 (const char *restrict string
, char **restrict endptr
,
1760 _GL_CXXALIASWARN (strtoll
);
1761 #elif defined GNULIB_POSIXCHECK
1763 # if HAVE_RAW_DECL_STRTOLL
1764 _GL_WARN_ON_USE (strtoll
, "strtoll is unportable - "
1765 "use gnulib module strtoll for portability");
1769 #if @GNULIB_STRTOUL@
1770 /* Parse an unsigned integer whose textual representation starts at STRING.
1771 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1772 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1774 If ENDPTR is not NULL, the address of the first byte after the integer is
1776 Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */
1777 # if @REPLACE_STRTOUL@
1778 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1779 # define strtoul rpl_strtoul
1781 # define GNULIB_defined_strtoul_function 1
1782 _GL_FUNCDECL_RPL (strtoul
, unsigned long,
1783 (const char *restrict string
, char **restrict endptr
,
1785 _GL_ARG_NONNULL ((1)));
1786 _GL_CXXALIAS_RPL (strtoul
, unsigned long,
1787 (const char *restrict string
, char **restrict endptr
,
1790 # if !@HAVE_STRTOUL@
1791 _GL_FUNCDECL_SYS (strtoul
, unsigned long,
1792 (const char *restrict string
, char **restrict endptr
,
1794 _GL_ARG_NONNULL ((1)));
1796 _GL_CXXALIAS_SYS (strtoul
, unsigned long,
1797 (const char *restrict string
, char **restrict endptr
,
1801 _GL_CXXALIASWARN (strtoul
);
1803 #elif defined GNULIB_POSIXCHECK
1805 # if HAVE_RAW_DECL_STRTOUL
1806 _GL_WARN_ON_USE (strtoul
, "strtoul is unportable - "
1807 "use gnulib module strtoul for portability");
1811 #if @GNULIB_STRTOULL@
1812 /* Parse an unsigned integer whose textual representation starts at STRING.
1813 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1814 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1816 If ENDPTR is not NULL, the address of the first byte after the integer is
1818 Upon overflow, the return value is ULLONG_MAX, and errno is set to
1820 # if @REPLACE_STRTOULL@
1821 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1822 # define strtoull rpl_strtoull
1824 # define GNULIB_defined_strtoull_function 1
1825 _GL_FUNCDECL_RPL (strtoull
, unsigned long long,
1826 (const char *restrict string
, char **restrict endptr
,
1828 _GL_ARG_NONNULL ((1)));
1829 _GL_CXXALIAS_RPL (strtoull
, unsigned long long,
1830 (const char *restrict string
, char **restrict endptr
,
1833 # if !@HAVE_STRTOULL@
1834 _GL_FUNCDECL_SYS (strtoull
, unsigned long long,
1835 (const char *restrict string
, char **restrict endptr
,
1837 _GL_ARG_NONNULL ((1)));
1839 _GL_CXXALIAS_SYS (strtoull
, unsigned long long,
1840 (const char *restrict string
, char **restrict endptr
,
1843 _GL_CXXALIASWARN (strtoull
);
1844 #elif defined GNULIB_POSIXCHECK
1846 # if HAVE_RAW_DECL_STRTOULL
1847 _GL_WARN_ON_USE (strtoull
, "strtoull is unportable - "
1848 "use gnulib module strtoull for portability");
1852 #if @GNULIB_UNLOCKPT@
1853 /* Unlock the slave side of the pseudo-terminal whose master side is specified
1854 by FD, so that it can be opened. */
1855 # if !@HAVE_UNLOCKPT@
1856 _GL_FUNCDECL_SYS (unlockpt
, int, (int fd
));
1858 _GL_CXXALIAS_SYS (unlockpt
, int, (int fd
));
1859 _GL_CXXALIASWARN (unlockpt
);
1860 #elif defined GNULIB_POSIXCHECK
1862 # if HAVE_RAW_DECL_UNLOCKPT
1863 _GL_WARN_ON_USE (unlockpt
, "unlockpt is not portable - "
1864 "use gnulib module unlockpt for portability");
1868 #if @GNULIB_UNSETENV@
1869 /* Remove the variable NAME from the environment. */
1870 # if @REPLACE_UNSETENV@
1871 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1873 # define unsetenv rpl_unsetenv
1875 _GL_FUNCDECL_RPL (unsetenv
, int, (const char *name
) _GL_ARG_NONNULL ((1)));
1876 _GL_CXXALIAS_RPL (unsetenv
, int, (const char *name
));
1878 # if !@HAVE_DECL_UNSETENV@
1879 _GL_FUNCDECL_SYS (unsetenv
, int, (const char *name
) _GL_ARG_NONNULL ((1)));
1881 _GL_CXXALIAS_SYS (unsetenv
, int, (const char *name
));
1883 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
1884 _GL_CXXALIASWARN (unsetenv
);
1886 #elif defined GNULIB_POSIXCHECK
1888 # if HAVE_RAW_DECL_UNSETENV
1889 _GL_WARN_ON_USE (unsetenv
, "unsetenv is unportable - "
1890 "use gnulib module unsetenv for portability");
1894 /* Convert a wide character to a multibyte character. */
1896 # if @REPLACE_WCTOMB@
1897 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1899 # define wctomb rpl_wctomb
1901 _GL_FUNCDECL_RPL (wctomb
, int, (char *s
, wchar_t wc
));
1902 _GL_CXXALIAS_RPL (wctomb
, int, (char *s
, wchar_t wc
));
1904 _GL_CXXALIAS_SYS (wctomb
, int, (char *s
, wchar_t wc
));
1907 _GL_CXXALIASWARN (wctomb
);
1912 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1913 #endif /* _@GUARD_PREFIX@_STDLIB_H */