gitlog-to-changelog: Tweak documentation.
[gnulib.git] / lib / stdlib.in.h
blobcfc69d0a50629ef51033c861530b7591997d9100
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/>. */
18 #if __GNUC__ >= 3
19 @PRAGMA_SYSTEM_HEADER@
20 #endif
21 @PRAGMA_COLUMNS@
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
33 #else
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,
46 HAVE_RAW_DECL_*. */
47 #if !_GL_CONFIG_H_INCLUDED
48 #error "Please include config.h first."
49 #endif
51 /* NetBSD 5.0 mis-defines NULL. */
52 #include <stddef.h>
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>
57 #endif
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
62 <sys/loadavg.h>. */
63 # include <sys/time.h>
64 # include <sys/loadavg.h>
65 #endif
67 /* Native Windows platforms declare _mktemp() in <io.h>. */
68 #if defined _WIN32 && !defined __CYGWIN__
69 # include <io.h>
70 #endif
72 #if @GNULIB_RANDOM_R@
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'. */
77 # if @HAVE_RANDOM_H@
78 # include <random.h>
79 # endif
81 # include <stdint.h>
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
87 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
98 # endif
99 # endif
100 #endif
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. */
108 # include <unistd.h>
109 #endif
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
113 function F. */
114 #ifndef _GL_ATTRIBUTE_DEALLOC
115 # if __GNUC__ >= 11
116 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
117 # else
118 # define _GL_ATTRIBUTE_DEALLOC(f, i)
119 # endif
120 #endif
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)
127 #endif
129 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
130 allocated memory. */
131 /* Applies to: functions. */
132 #ifndef _GL_ATTRIBUTE_MALLOC
133 # if __GNUC__ >= 3 || defined __clang__
134 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
135 # else
136 # define _GL_ATTRIBUTE_MALLOC
137 # endif
138 #endif
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)
147 # else
148 # define _GL_ATTRIBUTE_NOTHROW throw ()
149 # endif
150 # else
151 # define _GL_ATTRIBUTE_NOTHROW
152 # endif
153 # else
154 # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
155 # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
156 # else
157 # define _GL_ATTRIBUTE_NOTHROW
158 # endif
159 # endif
160 #endif
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__))
167 # else
168 # define _GL_ATTRIBUTE_PURE /* empty */
169 # endif
170 #endif
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. */
182 #ifndef EXIT_SUCCESS
183 # define EXIT_SUCCESS 0
184 #endif
185 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
186 with proper operation of xargs. */
187 #ifndef EXIT_FAILURE
188 # define EXIT_FAILURE 1
189 #elif EXIT_FAILURE != 1
190 # undef EXIT_FAILURE
191 # define EXIT_FAILURE 1
192 #endif
195 #if @GNULIB__EXIT@
196 /* Terminate the current process with the given return code, without running
197 the 'atexit' handlers. */
198 # if @REPLACE__EXIT@
199 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
200 # undef _Exit
201 # define _Exit rpl__Exit
202 # endif
203 _GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status));
204 _GL_CXXALIAS_RPL (_Exit, void, (int status));
205 # else
206 # if !@HAVE__EXIT@
207 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
208 # endif
209 _GL_CXXALIAS_SYS (_Exit, void, (int status));
210 # endif
211 # if __GLIBC__ >= 2
212 _GL_CXXALIASWARN (_Exit);
213 # endif
214 #elif defined GNULIB_POSIXCHECK
215 # undef _Exit
216 # if HAVE_RAW_DECL__EXIT
217 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
218 "use gnulib module _Exit for portability");
219 # endif
220 #endif
223 #if @GNULIB_ABORT_DEBUG@
224 # if @REPLACE_ABORT@
225 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
226 # undef abort
227 # define abort rpl_abort
228 # endif
229 _GL_FUNCDECL_RPL (abort, _Noreturn void, (void));
230 _GL_CXXALIAS_RPL (abort, void, (void));
231 # else
232 _GL_CXXALIAS_SYS (abort, void, (void));
233 # endif
234 # if __GLIBC__ >= 2
235 _GL_CXXALIASWARN (abort);
236 # endif
237 #endif
238 #if @GNULIB_ABORT_DEBUG@ && @REPLACE_ABORT@
239 _GL_EXTERN_C void _gl_pre_abort (void);
240 #else
241 # if !GNULIB_defined_gl_pre_abort
242 # define _gl_pre_abort() /* nothing */
243 # define GNULIB_defined_gl_pre_abort 1
244 # endif
245 #endif
248 #if @GNULIB_FREE_POSIX@
249 # if @REPLACE_FREE@
250 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
251 # undef free
252 # define free rpl_free
253 # endif
254 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
255 _GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW);
256 # else
257 _GL_FUNCDECL_RPL (free, void, (void *ptr));
258 # endif
259 _GL_CXXALIAS_RPL (free, void, (void *ptr));
260 # else
261 _GL_CXXALIAS_SYS (free, void, (void *ptr));
262 # endif
263 # if __GLIBC__ >= 2
264 _GL_CXXALIASWARN (free);
265 # endif
266 #elif defined GNULIB_POSIXCHECK
267 # undef free
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");
271 #endif
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
280 # endif
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));
285 # else
286 # if @HAVE_ALIGNED_ALLOC@
287 # if __GNUC__ >= 11
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);
294 # else
295 _GL_FUNCDECL_SYS (aligned_alloc, void *,
296 (size_t alignment, size_t size)
297 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
298 # endif
299 # endif
300 _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
301 # endif
302 # endif
303 # if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@
304 _GL_CXXALIASWARN (aligned_alloc);
305 # endif
306 #else
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);
314 # else
315 _GL_FUNCDECL_SYS (aligned_alloc, void *,
316 (size_t alignment, size_t size)
317 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
318 # endif
319 # endif
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");
325 # endif
326 # endif
327 #endif
329 #if @GNULIB_ATOLL@
330 /* Parse a signed decimal integer.
331 Returns the value of the integer. Errors are not detected. */
332 # if !@HAVE_ATOLL@
333 _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
334 _GL_ATTRIBUTE_PURE
335 _GL_ARG_NONNULL ((1)));
336 # endif
337 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
338 _GL_CXXALIASWARN (atoll);
339 #elif defined GNULIB_POSIXCHECK
340 # undef atoll
341 # if HAVE_RAW_DECL_ATOLL
342 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
343 "use gnulib module atoll for portability");
344 # endif
345 #endif
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)
351 # undef calloc
352 # define calloc rpl_calloc
353 # endif
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));
358 # else
359 # if __GNUC__ >= 11
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);
366 # else
367 _GL_FUNCDECL_SYS (calloc, void *,
368 (size_t nmemb, size_t size)
369 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
370 # endif
371 # endif
372 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
373 # endif
374 # if __GLIBC__ >= 2
375 _GL_CXXALIASWARN (calloc);
376 # endif
377 #else
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);
385 # else
386 _GL_FUNCDECL_SYS (calloc, void *,
387 (size_t nmemb, size_t size)
388 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
389 # endif
390 # endif
391 # if defined GNULIB_POSIXCHECK
392 # undef calloc
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");
396 # endif
397 #endif
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
403 # endif
404 _GL_FUNCDECL_RPL (canonicalize_file_name, char *,
405 (const char *name)
406 _GL_ARG_NONNULL ((1))
407 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
408 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
409 # else
410 # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
411 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
412 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
413 (const char *name)
414 _GL_ATTRIBUTE_NOTHROW
415 _GL_ARG_NONNULL ((1))
416 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
417 # else
418 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
419 (const char *name)
420 _GL_ARG_NONNULL ((1))
421 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
422 # endif
423 # endif
424 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
425 # endif
426 # ifndef GNULIB_defined_canonicalize_file_name
427 # define GNULIB_defined_canonicalize_file_name \
428 (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
429 # endif
430 _GL_CXXALIASWARN (canonicalize_file_name);
431 #else
432 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
433 /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
434 rpl_free. */
435 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
436 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
437 (const char *name)
438 _GL_ATTRIBUTE_NOTHROW
439 _GL_ARG_NONNULL ((1))
440 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
441 # else
442 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
443 (const char *name)
444 _GL_ARG_NONNULL ((1))
445 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
446 # endif
447 # endif
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");
454 # endif
455 # endif
456 #endif
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
462 it. */
463 # if defined _WIN32 && !defined __CYGWIN__
464 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
465 # undef ecvt
466 # define ecvt _ecvt
467 # endif
468 _GL_CXXALIAS_MDA (ecvt, char *,
469 (double number, int ndigits, int *decptp, int *signp));
470 # else
471 # if @HAVE_DECL_ECVT@
472 _GL_CXXALIAS_SYS (ecvt, char *,
473 (double number, int ndigits, int *decptp, int *signp));
474 # endif
475 # endif
476 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
477 _GL_CXXALIASWARN (ecvt);
478 # endif
479 #endif
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
485 it. */
486 # if defined _WIN32 && !defined __CYGWIN__
487 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
488 # undef fcvt
489 # define fcvt _fcvt
490 # endif
491 _GL_CXXALIAS_MDA (fcvt, char *,
492 (double number, int ndigits, int *decptp, int *signp));
493 # else
494 # if @HAVE_DECL_FCVT@
495 _GL_CXXALIAS_SYS (fcvt, char *,
496 (double number, int ndigits, int *decptp, int *signp));
497 # endif
498 # endif
499 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
500 _GL_CXXALIASWARN (fcvt);
501 # endif
502 #endif
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
508 it. */
509 # if defined _WIN32 && !defined __CYGWIN__
510 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
511 # undef gcvt
512 # define gcvt _gcvt
513 # endif
514 _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
515 # else
516 # if @HAVE_DECL_GCVT@
517 _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
518 # endif
519 # endif
520 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
521 _GL_CXXALIASWARN (gcvt);
522 # endif
523 #endif
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)
532 # undef getloadavg
533 # define getloadavg rpl_getloadavg
534 # endif
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));
538 # else
539 # if !@HAVE_DECL_GETLOADAVG@
540 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
541 _GL_ARG_NONNULL ((1)));
542 # endif
543 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
544 # endif
545 # if __GLIBC__ >= 2
546 _GL_CXXALIASWARN (getloadavg);
547 # endif
548 #elif defined GNULIB_POSIXCHECK
549 # undef getloadavg
550 # if HAVE_RAW_DECL_GETLOADAVG
551 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
552 "use gnulib module getloadavg for portability");
553 # endif
554 #endif
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)
561 # undef getprogname
562 # define getprogname rpl_getprogname
563 # endif
564 # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
565 _GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
566 # else
567 _GL_FUNCDECL_RPL (getprogname, const char *, (void));
568 # endif
569 _GL_CXXALIAS_RPL (getprogname, const char *, (void));
570 # else
571 # if !@HAVE_GETPROGNAME@
572 # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
573 _GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
574 # else
575 _GL_FUNCDECL_SYS (getprogname, const char *, (void));
576 # endif
577 # endif
578 _GL_CXXALIAS_SYS (getprogname, const char *, (void));
579 # endif
580 # if __GLIBC__ >= 2
581 _GL_CXXALIASWARN (getprogname);
582 # endif
583 #elif defined GNULIB_POSIXCHECK
584 # undef getprogname
585 # if HAVE_RAW_DECL_GETPROGNAME
586 _GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
587 "use gnulib module getprogname for portability");
588 # endif
589 #endif
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)
605 # undef getsubopt
606 # define getsubopt rpl_getsubopt
607 # endif
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));
613 # else
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)));
618 # endif
619 _GL_CXXALIAS_SYS (getsubopt, int,
620 (char **optionp, char *const *tokens, char **valuep));
621 # endif
622 # if __GLIBC__ >= 2
623 _GL_CXXALIASWARN (getsubopt);
624 # endif
625 #elif defined GNULIB_POSIXCHECK
626 # undef getsubopt
627 # if HAVE_RAW_DECL_GETSUBOPT
628 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
629 "use gnulib module getsubopt for portability");
630 # endif
631 #endif
633 #if @GNULIB_GRANTPT@
634 /* Change the ownership and access permission of the slave side of the
635 pseudo-terminal whose master side is specified by FD. */
636 # if !@HAVE_GRANTPT@
637 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
638 # endif
639 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
640 _GL_CXXALIASWARN (grantpt);
641 #elif defined GNULIB_POSIXCHECK
642 # undef grantpt
643 # if HAVE_RAW_DECL_GRANTPT
644 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
645 "use gnulib module grantpt for portability");
646 # endif
647 #endif
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)
658 # undef malloc
659 # define malloc rpl_malloc
660 # endif
661 _GL_FUNCDECL_RPL (malloc, void *,
662 (size_t size)
663 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
664 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
665 # else
666 # if __GNUC__ >= 11
667 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
668 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
669 _GL_FUNCDECL_SYS (malloc, void *,
670 (size_t size)
671 _GL_ATTRIBUTE_NOTHROW
672 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
673 # else
674 _GL_FUNCDECL_SYS (malloc, void *,
675 (size_t size)
676 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
677 # endif
678 # endif
679 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
680 # endif
681 # if __GLIBC__ >= 2
682 _GL_CXXALIASWARN (malloc);
683 # endif
684 #else
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 *,
689 (size_t size)
690 _GL_ATTRIBUTE_NOTHROW
691 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
692 # else
693 _GL_FUNCDECL_SYS (malloc, void *,
694 (size_t size)
695 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
696 # endif
697 # endif
698 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
699 # undef malloc
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");
703 # endif
704 #endif
706 /* Return maximum number of bytes of a multibyte character. */
707 #if @REPLACE_MB_CUR_MAX@
708 # if !GNULIB_defined_MB_CUR_MAX
709 static inline
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);
715 # undef MB_CUR_MAX
716 # define MB_CUR_MAX gl_MB_CUR_MAX ()
717 # define GNULIB_defined_MB_CUR_MAX 1
718 # endif
719 #endif
721 /* Convert a string to a wide string. */
722 #if @GNULIB_MBSTOWCS@
723 # if @REPLACE_MBSTOWCS@
724 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
725 # undef mbstowcs
726 # define mbstowcs rpl_mbstowcs
727 # endif
728 _GL_FUNCDECL_RPL (mbstowcs, size_t,
729 (wchar_t *restrict dest, const char *restrict src,
730 size_t len)
731 _GL_ARG_NONNULL ((2)));
732 _GL_CXXALIAS_RPL (mbstowcs, size_t,
733 (wchar_t *restrict dest, const char *restrict src,
734 size_t len));
735 # else
736 _GL_CXXALIAS_SYS (mbstowcs, size_t,
737 (wchar_t *restrict dest, const char *restrict src,
738 size_t len));
739 # endif
740 # if __GLIBC__ >= 2
741 _GL_CXXALIASWARN (mbstowcs);
742 # endif
743 #elif defined GNULIB_POSIXCHECK
744 # undef mbstowcs
745 # if HAVE_RAW_DECL_MBSTOWCS
746 _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
747 "use gnulib module mbstowcs for portability");
748 # endif
749 #endif
751 /* Convert a multibyte character to a wide character. */
752 #if @GNULIB_MBTOWC@
753 # if @REPLACE_MBTOWC@
754 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
755 # undef mbtowc
756 # define mbtowc rpl_mbtowc
757 # endif
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));
762 # else
763 # if !@HAVE_MBTOWC@
764 _GL_FUNCDECL_SYS (mbtowc, int,
765 (wchar_t *restrict pwc, const char *restrict s, size_t n));
766 # endif
767 _GL_CXXALIAS_SYS (mbtowc, int,
768 (wchar_t *restrict pwc, const char *restrict s, size_t n));
769 # endif
770 # if __GLIBC__ >= 2
771 _GL_CXXALIASWARN (mbtowc);
772 # endif
773 #elif defined GNULIB_POSIXCHECK
774 # undef mbtowc
775 # if HAVE_RAW_DECL_MBTOWC
776 _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
777 "use gnulib module mbtowc for portability");
778 # endif
779 #endif
781 #if @GNULIB_MKDTEMP@
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. */
787 # if !@HAVE_MKDTEMP@
788 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
789 # endif
790 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
791 _GL_CXXALIASWARN (mkdtemp);
792 #elif defined GNULIB_POSIXCHECK
793 # undef mkdtemp
794 # if HAVE_RAW_DECL_MKDTEMP
795 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
796 "use gnulib module mkdtemp for portability");
797 # endif
798 #endif
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
807 before.
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
810 implementation.
811 Returns the open file descriptor if successful, otherwise -1 and errno
812 set. */
813 # if @REPLACE_MKOSTEMP@
814 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
815 # undef mkostemp
816 # define mkostemp rpl_mkostemp
817 # endif
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*/));
821 # else
822 # if !@HAVE_MKOSTEMP@
823 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
824 _GL_ARG_NONNULL ((1)));
825 # endif
826 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
827 # endif
828 # if __GLIBC__ >= 2
829 _GL_CXXALIASWARN (mkostemp);
830 # endif
831 #elif defined GNULIB_POSIXCHECK
832 # undef mkostemp
833 # if HAVE_RAW_DECL_MKOSTEMP
834 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
835 "use gnulib module mkostemp for portability");
836 # endif
837 #endif
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
847 before.
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
850 implementation.
851 Returns the open file descriptor if successful, otherwise -1 and errno
852 set. */
853 # if @REPLACE_MKOSTEMPS@
854 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
855 # undef mkostemps
856 # define mkostemps rpl_mkostemps
857 # endif
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*/));
863 # else
864 # if !@HAVE_MKOSTEMPS@
865 _GL_FUNCDECL_SYS (mkostemps, int,
866 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
867 _GL_ARG_NONNULL ((1)));
868 # endif
869 _GL_CXXALIAS_SYS (mkostemps, int,
870 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
871 # endif
872 # if __GLIBC__ >= 2
873 _GL_CXXALIASWARN (mkostemps);
874 # endif
875 #elif defined GNULIB_POSIXCHECK
876 # undef mkostemps
877 # if HAVE_RAW_DECL_MKOSTEMPS
878 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
879 "use gnulib module mkostemps for portability");
880 # endif
881 #endif
883 #if @GNULIB_MKSTEMP@
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
890 implementation.
891 Returns the open file descriptor if successful, otherwise -1 and errno
892 set. */
893 # if @REPLACE_MKSTEMP@
894 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
895 # define mkstemp rpl_mkstemp
896 # endif
897 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
898 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
899 # else
900 # if ! @HAVE_MKSTEMP@
901 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
902 # endif
903 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
904 # endif
905 _GL_CXXALIASWARN (mkstemp);
906 #elif defined GNULIB_POSIXCHECK
907 # undef mkstemp
908 # if HAVE_RAW_DECL_MKSTEMP
909 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
910 "use gnulib module mkstemp for portability");
911 # endif
912 #endif
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
922 implementation.
923 Returns the open file descriptor if successful, otherwise -1 and errno
924 set. */
925 # if !@HAVE_MKSTEMPS@
926 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
927 _GL_ARG_NONNULL ((1)));
928 # endif
929 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
930 _GL_CXXALIASWARN (mkstemps);
931 #elif defined GNULIB_POSIXCHECK
932 # undef mkstemps
933 # if HAVE_RAW_DECL_MKSTEMPS
934 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
935 "use gnulib module mkstemps for portability");
936 # endif
937 #endif
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)
945 # undef mktemp
946 # define mktemp _mktemp
947 # endif
948 _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
949 # else
950 _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
951 # endif
952 _GL_CXXALIASWARN (mktemp);
953 #endif
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
961 # endif
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));
967 # else
968 # if @HAVE_POSIX_MEMALIGN@
969 _GL_CXXALIAS_SYS (posix_memalign, int,
970 (void **memptr, size_t alignment, size_t size));
971 # endif
972 # endif
973 # if __GLIBC__ >= 2 && @HAVE_POSIX_MEMALIGN@
974 _GL_CXXALIASWARN (posix_memalign);
975 # endif
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");
981 # endif
982 #endif
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)
989 # undef posix_openpt
990 # define posix_openpt rpl_posix_openpt
991 # endif
992 _GL_FUNCDECL_RPL (posix_openpt, int, (int flags));
993 _GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
994 # else
995 # if !@HAVE_POSIX_OPENPT@
996 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
997 # endif
998 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
999 # endif
1000 # if __GLIBC__ >= 2
1001 _GL_CXXALIASWARN (posix_openpt);
1002 # endif
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");
1008 # endif
1009 #endif
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)
1016 # undef ptsname
1017 # define ptsname rpl_ptsname
1018 # endif
1019 _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
1020 _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
1021 # else
1022 # if !@HAVE_PTSNAME@
1023 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
1024 # endif
1025 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
1026 # endif
1027 _GL_CXXALIASWARN (ptsname);
1028 #elif defined GNULIB_POSIXCHECK
1029 # undef ptsname
1030 # if HAVE_RAW_DECL_PTSNAME
1031 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
1032 "use gnulib module ptsname for portability");
1033 # endif
1034 #endif
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)
1042 # undef ptsname_r
1043 # define ptsname_r rpl_ptsname_r
1044 # endif
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));
1047 # else
1048 # if !@HAVE_PTSNAME_R@
1049 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1050 # endif
1051 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1052 # endif
1053 # ifndef GNULIB_defined_ptsname_r
1054 # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
1055 # endif
1056 _GL_CXXALIASWARN (ptsname_r);
1057 #elif defined GNULIB_POSIXCHECK
1058 # undef ptsname_r
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");
1062 # endif
1063 #endif
1065 #if @GNULIB_PUTENV@
1066 # if @REPLACE_PUTENV@
1067 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1068 # undef putenv
1069 # define putenv rpl_putenv
1070 # endif
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)
1075 # undef putenv
1076 # define putenv _putenv
1077 # endif
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));
1083 # else
1084 _GL_CXXALIAS_SYS (putenv, int, (char *string));
1085 # endif
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)
1093 # undef putenv
1094 # define putenv _putenv
1095 # endif
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));
1103 # else
1104 _GL_CXXALIAS_SYS (putenv, int, (char *string));
1105 # endif
1106 _GL_CXXALIASWARN (putenv);
1107 #endif
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. */
1113 # ifdef __cplusplus
1114 extern "C" {
1115 # endif
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
1119 # endif
1120 # ifdef __cplusplus
1122 # endif
1123 # if @REPLACE_QSORT_R@
1124 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1125 # undef qsort_r
1126 # define qsort_r rpl_qsort_r
1127 # endif
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,
1133 void *arg));
1134 # else
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)));
1139 # endif
1140 _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1141 _gl_qsort_r_compar_fn compare,
1142 void *arg));
1143 # endif
1144 # if __GLIBC__ >= 2
1145 _GL_CXXALIASWARN (qsort_r);
1146 # endif
1147 #elif defined GNULIB_POSIXCHECK
1148 # undef qsort_r
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");
1152 # endif
1153 #endif
1156 #if @GNULIB_RAND@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@)
1157 # ifndef RAND_MAX
1158 # define RAND_MAX 2147483647
1159 # endif
1160 #endif
1163 #if @GNULIB_RAND@
1164 # if @REPLACE_RAND@
1165 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1166 # undef rand
1167 # define rand rpl_rand
1168 # endif
1169 _GL_FUNCDECL_RPL (rand, int, (void));
1170 _GL_CXXALIAS_RPL (rand, int, (void));
1171 # else
1172 _GL_CXXALIAS_SYS (rand, int, (void));
1173 # endif
1174 # if __GLIBC__ >= 2
1175 _GL_CXXALIASWARN (rand);
1176 # endif
1177 #endif
1180 #if @GNULIB_RANDOM@
1181 # if @REPLACE_RANDOM@
1182 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1183 # undef random
1184 # define random rpl_random
1185 # endif
1186 _GL_FUNCDECL_RPL (random, long, (void));
1187 _GL_CXXALIAS_RPL (random, long, (void));
1188 # else
1189 # if !@HAVE_RANDOM@
1190 _GL_FUNCDECL_SYS (random, long, (void));
1191 # endif
1192 /* Need to cast, because on Haiku, the return type is
1193 int. */
1194 _GL_CXXALIAS_SYS_CAST (random, long, (void));
1195 # endif
1196 # if __GLIBC__ >= 2
1197 _GL_CXXALIASWARN (random);
1198 # endif
1199 #elif defined GNULIB_POSIXCHECK
1200 # undef random
1201 # if HAVE_RAW_DECL_RANDOM
1202 _GL_WARN_ON_USE (random, "random is unportable - "
1203 "use gnulib module random for portability");
1204 # endif
1205 #endif
1207 #if @GNULIB_RANDOM@
1208 # if @REPLACE_RANDOM@
1209 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1210 # undef srandom
1211 # define srandom rpl_srandom
1212 # endif
1213 _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
1214 _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
1215 # else
1216 # if !@HAVE_RANDOM@
1217 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
1218 # endif
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));
1222 # endif
1223 # if __GLIBC__ >= 2
1224 _GL_CXXALIASWARN (srandom);
1225 # endif
1226 #elif defined GNULIB_POSIXCHECK
1227 # undef srandom
1228 # if HAVE_RAW_DECL_SRANDOM
1229 _GL_WARN_ON_USE (srandom, "srandom is unportable - "
1230 "use gnulib module random for portability");
1231 # endif
1232 #endif
1234 #if @GNULIB_RANDOM@
1235 # if @REPLACE_INITSTATE@
1236 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1237 # undef initstate
1238 # define initstate rpl_initstate
1239 # endif
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));
1245 # else
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)));
1250 # endif
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));
1255 # endif
1256 # if __GLIBC__ >= 2
1257 _GL_CXXALIASWARN (initstate);
1258 # endif
1259 #elif defined GNULIB_POSIXCHECK
1260 # undef initstate
1261 # if HAVE_RAW_DECL_INITSTATE
1262 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
1263 "use gnulib module random for portability");
1264 # endif
1265 #endif
1267 #if @GNULIB_RANDOM@
1268 # if @REPLACE_SETSTATE@
1269 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1270 # undef setstate
1271 # define setstate rpl_setstate
1272 # endif
1273 _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1274 _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
1275 # else
1276 # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
1277 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1278 # endif
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));
1282 # endif
1283 # if __GLIBC__ >= 2
1284 _GL_CXXALIASWARN (setstate);
1285 # endif
1286 #elif defined GNULIB_POSIXCHECK
1287 # undef setstate
1288 # if HAVE_RAW_DECL_SETSTATE
1289 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
1290 "use gnulib module random for portability");
1291 # endif
1292 #endif
1295 #if @GNULIB_RANDOM_R@
1296 # if @REPLACE_RANDOM_R@
1297 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1298 # undef random_r
1299 # define random_r rpl_random_r
1300 # endif
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));
1304 # else
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)));
1308 # endif
1309 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
1310 # endif
1311 _GL_CXXALIASWARN (random_r);
1312 #elif defined GNULIB_POSIXCHECK
1313 # undef random_r
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");
1317 # endif
1318 #endif
1320 #if @GNULIB_RANDOM_R@
1321 # if @REPLACE_RANDOM_R@
1322 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1323 # undef srandom_r
1324 # define srandom_r rpl_srandom_r
1325 # endif
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));
1331 # else
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)));
1336 # endif
1337 _GL_CXXALIAS_SYS (srandom_r, int,
1338 (unsigned int seed, struct random_data *rand_state));
1339 # endif
1340 _GL_CXXALIASWARN (srandom_r);
1341 #elif defined GNULIB_POSIXCHECK
1342 # undef srandom_r
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");
1346 # endif
1347 #endif
1349 #if @GNULIB_RANDOM_R@
1350 # if @REPLACE_RANDOM_R@
1351 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1352 # undef initstate_r
1353 # define initstate_r rpl_initstate_r
1354 # endif
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));
1362 # else
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)));
1368 # endif
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));
1374 # endif
1375 _GL_CXXALIASWARN (initstate_r);
1376 #elif defined GNULIB_POSIXCHECK
1377 # undef initstate_r
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");
1381 # endif
1382 #endif
1384 #if @GNULIB_RANDOM_R@
1385 # if @REPLACE_RANDOM_R@
1386 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1387 # undef setstate_r
1388 # define setstate_r rpl_setstate_r
1389 # endif
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));
1395 # else
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)));
1400 # endif
1401 /* Need to cast, because on Haiku, the first parameter is
1402 void *arg_state. */
1403 _GL_CXXALIAS_SYS_CAST (setstate_r, int,
1404 (char *arg_state, struct random_data *rand_state));
1405 # endif
1406 _GL_CXXALIASWARN (setstate_r);
1407 #elif defined GNULIB_POSIXCHECK
1408 # undef setstate_r
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");
1412 # endif
1413 #endif
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)
1421 # undef realloc
1422 # define realloc rpl_realloc
1423 # endif
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));
1427 # else
1428 # if __GNUC__ >= 11
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);
1435 # else
1436 _GL_FUNCDECL_SYS (realloc, void *,
1437 (void *ptr, size_t size)
1438 _GL_ATTRIBUTE_DEALLOC_FREE);
1439 # endif
1440 # endif
1441 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1442 # endif
1443 # if __GLIBC__ >= 2
1444 _GL_CXXALIASWARN (realloc);
1445 # endif
1446 #else
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);
1454 # else
1455 _GL_FUNCDECL_SYS (realloc, void *,
1456 (void *ptr, size_t size)
1457 _GL_ATTRIBUTE_DEALLOC_FREE);
1458 # endif
1459 # endif
1460 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1461 # undef realloc
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");
1465 # endif
1466 #endif
1469 #if @GNULIB_REALLOCARRAY@
1470 # if @REPLACE_REALLOCARRAY@
1471 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1472 # undef reallocarray
1473 # define reallocarray rpl_reallocarray
1474 # endif
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));
1479 # else
1480 # if ! @HAVE_REALLOCARRAY@
1481 _GL_FUNCDECL_SYS (reallocarray, void *,
1482 (void *ptr, size_t nmemb, size_t size));
1483 # endif
1484 _GL_CXXALIAS_SYS (reallocarray, void *,
1485 (void *ptr, size_t nmemb, size_t size));
1486 # endif
1487 # if __GLIBC__ >= 2
1488 _GL_CXXALIASWARN (reallocarray);
1489 # endif
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");
1495 # endif
1496 #endif
1498 #if @GNULIB_REALPATH@
1499 # if @REPLACE_REALPATH@
1500 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1501 # define realpath rpl_realpath
1502 # endif
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));
1508 # else
1509 # if !@HAVE_REALPATH@
1510 _GL_FUNCDECL_SYS (realpath, char *,
1511 (const char *restrict name, char *restrict resolved)
1512 _GL_ARG_NONNULL ((1)));
1513 # endif
1514 _GL_CXXALIAS_SYS (realpath, char *,
1515 (const char *restrict name, char *restrict resolved));
1516 # endif
1517 _GL_CXXALIASWARN (realpath);
1518 #elif defined GNULIB_POSIXCHECK
1519 # undef realpath
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");
1523 # endif
1524 #endif
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)));
1531 # endif
1532 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1533 _GL_CXXALIASWARN (rpmatch);
1534 #elif defined GNULIB_POSIXCHECK
1535 # undef rpmatch
1536 # if HAVE_RAW_DECL_RPMATCH
1537 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1538 "use gnulib module rpmatch for portability");
1539 # endif
1540 #endif
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)));
1547 # endif
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");
1555 # endif
1556 #endif
1558 #if @GNULIB_SETENV@
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)
1563 # undef setenv
1564 # define setenv rpl_setenv
1565 # endif
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));
1571 # else
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)));
1576 # endif
1577 _GL_CXXALIAS_SYS (setenv, int,
1578 (const char *name, const char *value, int replace));
1579 # endif
1580 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
1581 _GL_CXXALIASWARN (setenv);
1582 # endif
1583 #elif defined GNULIB_POSIXCHECK
1584 # undef setenv
1585 # if HAVE_RAW_DECL_SETENV
1586 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1587 "use gnulib module setenv for portability");
1588 # endif
1589 #endif
1591 #if @GNULIB_STRTOD@
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
1596 # endif
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));
1603 # else
1604 # if !@HAVE_STRTOD@
1605 _GL_FUNCDECL_SYS (strtod, double,
1606 (const char *restrict str, char **restrict endp)
1607 _GL_ARG_NONNULL ((1)));
1608 # endif
1609 _GL_CXXALIAS_SYS (strtod, double,
1610 (const char *restrict str, char **restrict endp));
1611 # endif
1612 # if __GLIBC__ >= 2
1613 _GL_CXXALIASWARN (strtod);
1614 # endif
1615 #elif defined GNULIB_POSIXCHECK
1616 # undef strtod
1617 # if HAVE_RAW_DECL_STRTOD
1618 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1619 "use gnulib module strtod for portability");
1620 # endif
1621 #endif
1623 #if @GNULIB_STRTOF@
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
1628 # endif
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));
1635 # else
1636 # if !@HAVE_STRTOF@
1637 _GL_FUNCDECL_SYS (strtof, float,
1638 (const char *restrict str, char **restrict endp)
1639 _GL_ARG_NONNULL ((1)));
1640 # endif
1641 _GL_CXXALIAS_SYS (strtof, float,
1642 (const char *restrict str, char **restrict endp));
1643 # endif
1644 # if __GLIBC__ >= 2
1645 _GL_CXXALIASWARN (strtof);
1646 # endif
1647 #elif defined GNULIB_POSIXCHECK
1648 # undef strtof
1649 # if HAVE_RAW_DECL_STRTOF
1650 _GL_WARN_ON_USE (strtof, "strtof is unportable - "
1651 "use gnulib module strtof for portability");
1652 # endif
1653 #endif
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
1660 # endif
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));
1667 # else
1668 # if !@HAVE_STRTOLD@
1669 _GL_FUNCDECL_SYS (strtold, long double,
1670 (const char *restrict str, char **restrict endp)
1671 _GL_ARG_NONNULL ((1)));
1672 # endif
1673 _GL_CXXALIAS_SYS (strtold, long double,
1674 (const char *restrict str, char **restrict endp));
1675 # endif
1676 _GL_CXXALIASWARN (strtold);
1677 #elif defined GNULIB_POSIXCHECK
1678 # undef strtold
1679 # if HAVE_RAW_DECL_STRTOLD
1680 _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1681 "use gnulib module strtold for portability");
1682 # endif
1683 #endif
1685 #if @GNULIB_STRTOL@
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
1689 "0x").
1690 If ENDPTR is not NULL, the address of the first byte after the integer is
1691 stored in *ENDPTR.
1692 Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
1693 to ERANGE. */
1694 # if @REPLACE_STRTOL@
1695 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1696 # define strtol rpl_strtol
1697 # endif
1698 # define GNULIB_defined_strtol_function 1
1699 _GL_FUNCDECL_RPL (strtol, long,
1700 (const char *restrict string, char **restrict endptr,
1701 int base)
1702 _GL_ARG_NONNULL ((1)));
1703 _GL_CXXALIAS_RPL (strtol, long,
1704 (const char *restrict string, char **restrict endptr,
1705 int base));
1706 # else
1707 # if !@HAVE_STRTOL@
1708 _GL_FUNCDECL_SYS (strtol, long,
1709 (const char *restrict string, char **restrict endptr,
1710 int base)
1711 _GL_ARG_NONNULL ((1)));
1712 # endif
1713 _GL_CXXALIAS_SYS (strtol, long,
1714 (const char *restrict string, char **restrict endptr,
1715 int base));
1716 # endif
1717 # if __GLIBC__ >= 2
1718 _GL_CXXALIASWARN (strtol);
1719 # endif
1720 #elif defined GNULIB_POSIXCHECK
1721 # undef strtol
1722 # if HAVE_RAW_DECL_STRTOL
1723 _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1724 "use gnulib module strtol for portability");
1725 # endif
1726 #endif
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
1732 "0x").
1733 If ENDPTR is not NULL, the address of the first byte after the integer is
1734 stored in *ENDPTR.
1735 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
1736 to ERANGE. */
1737 # if @REPLACE_STRTOLL@
1738 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1739 # define strtoll rpl_strtoll
1740 # endif
1741 # define GNULIB_defined_strtoll_function 1
1742 _GL_FUNCDECL_RPL (strtoll, long long,
1743 (const char *restrict string, char **restrict endptr,
1744 int base)
1745 _GL_ARG_NONNULL ((1)));
1746 _GL_CXXALIAS_RPL (strtoll, long long,
1747 (const char *restrict string, char **restrict endptr,
1748 int base));
1749 # else
1750 # if !@HAVE_STRTOLL@
1751 _GL_FUNCDECL_SYS (strtoll, long long,
1752 (const char *restrict string, char **restrict endptr,
1753 int base)
1754 _GL_ARG_NONNULL ((1)));
1755 # endif
1756 _GL_CXXALIAS_SYS (strtoll, long long,
1757 (const char *restrict string, char **restrict endptr,
1758 int base));
1759 # endif
1760 _GL_CXXALIASWARN (strtoll);
1761 #elif defined GNULIB_POSIXCHECK
1762 # undef strtoll
1763 # if HAVE_RAW_DECL_STRTOLL
1764 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1765 "use gnulib module strtoll for portability");
1766 # endif
1767 #endif
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
1773 "0x").
1774 If ENDPTR is not NULL, the address of the first byte after the integer is
1775 stored in *ENDPTR.
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
1780 # endif
1781 # define GNULIB_defined_strtoul_function 1
1782 _GL_FUNCDECL_RPL (strtoul, unsigned long,
1783 (const char *restrict string, char **restrict endptr,
1784 int base)
1785 _GL_ARG_NONNULL ((1)));
1786 _GL_CXXALIAS_RPL (strtoul, unsigned long,
1787 (const char *restrict string, char **restrict endptr,
1788 int base));
1789 # else
1790 # if !@HAVE_STRTOUL@
1791 _GL_FUNCDECL_SYS (strtoul, unsigned long,
1792 (const char *restrict string, char **restrict endptr,
1793 int base)
1794 _GL_ARG_NONNULL ((1)));
1795 # endif
1796 _GL_CXXALIAS_SYS (strtoul, unsigned long,
1797 (const char *restrict string, char **restrict endptr,
1798 int base));
1799 # endif
1800 # if __GLIBC__ >= 2
1801 _GL_CXXALIASWARN (strtoul);
1802 # endif
1803 #elif defined GNULIB_POSIXCHECK
1804 # undef strtoul
1805 # if HAVE_RAW_DECL_STRTOUL
1806 _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1807 "use gnulib module strtoul for portability");
1808 # endif
1809 #endif
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
1815 "0x").
1816 If ENDPTR is not NULL, the address of the first byte after the integer is
1817 stored in *ENDPTR.
1818 Upon overflow, the return value is ULLONG_MAX, and errno is set to
1819 ERANGE. */
1820 # if @REPLACE_STRTOULL@
1821 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1822 # define strtoull rpl_strtoull
1823 # endif
1824 # define GNULIB_defined_strtoull_function 1
1825 _GL_FUNCDECL_RPL (strtoull, unsigned long long,
1826 (const char *restrict string, char **restrict endptr,
1827 int base)
1828 _GL_ARG_NONNULL ((1)));
1829 _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1830 (const char *restrict string, char **restrict endptr,
1831 int base));
1832 # else
1833 # if !@HAVE_STRTOULL@
1834 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
1835 (const char *restrict string, char **restrict endptr,
1836 int base)
1837 _GL_ARG_NONNULL ((1)));
1838 # endif
1839 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
1840 (const char *restrict string, char **restrict endptr,
1841 int base));
1842 # endif
1843 _GL_CXXALIASWARN (strtoull);
1844 #elif defined GNULIB_POSIXCHECK
1845 # undef strtoull
1846 # if HAVE_RAW_DECL_STRTOULL
1847 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1848 "use gnulib module strtoull for portability");
1849 # endif
1850 #endif
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));
1857 # endif
1858 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1859 _GL_CXXALIASWARN (unlockpt);
1860 #elif defined GNULIB_POSIXCHECK
1861 # undef unlockpt
1862 # if HAVE_RAW_DECL_UNLOCKPT
1863 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1864 "use gnulib module unlockpt for portability");
1865 # endif
1866 #endif
1868 #if @GNULIB_UNSETENV@
1869 /* Remove the variable NAME from the environment. */
1870 # if @REPLACE_UNSETENV@
1871 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1872 # undef unsetenv
1873 # define unsetenv rpl_unsetenv
1874 # endif
1875 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1876 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1877 # else
1878 # if !@HAVE_DECL_UNSETENV@
1879 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1880 # endif
1881 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1882 # endif
1883 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
1884 _GL_CXXALIASWARN (unsetenv);
1885 # endif
1886 #elif defined GNULIB_POSIXCHECK
1887 # undef unsetenv
1888 # if HAVE_RAW_DECL_UNSETENV
1889 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1890 "use gnulib module unsetenv for portability");
1891 # endif
1892 #endif
1894 /* Convert a wide character to a multibyte character. */
1895 #if @GNULIB_WCTOMB@
1896 # if @REPLACE_WCTOMB@
1897 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1898 # undef wctomb
1899 # define wctomb rpl_wctomb
1900 # endif
1901 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
1902 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1903 # else
1904 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
1905 # endif
1906 # if __GLIBC__ >= 2
1907 _GL_CXXALIASWARN (wctomb);
1908 # endif
1909 #endif
1912 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1913 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1914 #endif