exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / stdlib.in.h
blobe74e7c18d19e0550ef6ca23e40f52e6b615caf85
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 #else
30 /* Normal invocation convention. */
32 #ifndef _@GUARD_PREFIX@_STDLIB_H
34 /* The include_next requires a split double-inclusion guard. */
35 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
37 #ifndef _@GUARD_PREFIX@_STDLIB_H
38 #define _@GUARD_PREFIX@_STDLIB_H
40 /* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
41 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
42 HAVE_RAW_DECL_*. */
43 #if !_GL_CONFIG_H_INCLUDED
44 #error "Please include config.h first."
45 #endif
47 /* NetBSD 5.0 mis-defines NULL. */
48 #include <stddef.h>
50 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
51 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
52 # include <sys/wait.h>
53 #endif
55 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
56 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
57 /* OpenIndiana has a bug: <sys/time.h> must be included before
58 <sys/loadavg.h>. */
59 # include <sys/time.h>
60 # include <sys/loadavg.h>
61 #endif
63 /* Native Windows platforms declare _mktemp() in <io.h>. */
64 #if defined _WIN32 && !defined __CYGWIN__
65 # include <io.h>
66 #endif
68 #if @GNULIB_RANDOM_R@
70 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
71 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
72 'struct random_data'. */
73 # if @HAVE_RANDOM_H@
74 # include <random.h>
75 # endif
77 # include <stdint.h>
79 # if !@HAVE_STRUCT_RANDOM_DATA@
80 /* Define 'struct random_data'.
81 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
82 # if !GNULIB_defined_struct_random_data
83 struct random_data
85 int32_t *fptr; /* Front pointer. */
86 int32_t *rptr; /* Rear pointer. */
87 int32_t *state; /* Array of state values. */
88 int rand_type; /* Type of random number generator. */
89 int rand_deg; /* Degree of random number generator. */
90 int rand_sep; /* Distance between front and rear. */
91 int32_t *end_ptr; /* Pointer behind state table. */
93 # define GNULIB_defined_struct_random_data 1
94 # endif
95 # endif
96 #endif
98 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
99 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
100 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
101 /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */
102 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
103 /* But avoid namespace pollution on glibc systems and native Windows. */
104 # include <unistd.h>
105 #endif
107 /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
108 that can be freed by passing them as the Ith argument to the
109 function F. */
110 #ifndef _GL_ATTRIBUTE_DEALLOC
111 # if __GNUC__ >= 11
112 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
113 # else
114 # define _GL_ATTRIBUTE_DEALLOC(f, i)
115 # endif
116 #endif
118 /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
119 can be freed via 'free'; it can be used only after declaring 'free'. */
120 /* Applies to: functions. Cannot be used on inline functions. */
121 #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
122 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
123 #endif
125 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
126 allocated memory. */
127 /* Applies to: functions. */
128 #ifndef _GL_ATTRIBUTE_MALLOC
129 # if __GNUC__ >= 3 || defined __clang__
130 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
131 # else
132 # define _GL_ATTRIBUTE_MALLOC
133 # endif
134 #endif
136 /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
138 #ifndef _GL_ATTRIBUTE_NOTHROW
139 # if defined __cplusplus
140 # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
141 # if __cplusplus >= 201103L
142 # define _GL_ATTRIBUTE_NOTHROW noexcept (true)
143 # else
144 # define _GL_ATTRIBUTE_NOTHROW throw ()
145 # endif
146 # else
147 # define _GL_ATTRIBUTE_NOTHROW
148 # endif
149 # else
150 # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
151 # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
152 # else
153 # define _GL_ATTRIBUTE_NOTHROW
154 # endif
155 # endif
156 #endif
158 /* The __attribute__ feature is available in gcc versions 2.5 and later.
159 The attribute __pure__ was added in gcc 2.96. */
160 #ifndef _GL_ATTRIBUTE_PURE
161 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
162 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
163 # else
164 # define _GL_ATTRIBUTE_PURE /* empty */
165 # endif
166 #endif
168 /* The definition of _Noreturn is copied here. */
170 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
172 /* The definition of _GL_ARG_NONNULL is copied here. */
174 /* The definition of _GL_WARN_ON_USE is copied here. */
177 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
178 #ifndef EXIT_SUCCESS
179 # define EXIT_SUCCESS 0
180 #endif
181 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
182 with proper operation of xargs. */
183 #ifndef EXIT_FAILURE
184 # define EXIT_FAILURE 1
185 #elif EXIT_FAILURE != 1
186 # undef EXIT_FAILURE
187 # define EXIT_FAILURE 1
188 #endif
191 #if @GNULIB__EXIT@
192 /* Terminate the current process with the given return code, without running
193 the 'atexit' handlers. */
194 # if @REPLACE__EXIT@
195 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
196 # undef _Exit
197 # define _Exit rpl__Exit
198 # endif
199 _GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status));
200 _GL_CXXALIAS_RPL (_Exit, void, (int status));
201 # else
202 # if !@HAVE__EXIT@
203 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
204 # endif
205 _GL_CXXALIAS_SYS (_Exit, void, (int status));
206 # endif
207 # if __GLIBC__ >= 2
208 _GL_CXXALIASWARN (_Exit);
209 # endif
210 #elif defined GNULIB_POSIXCHECK
211 # undef _Exit
212 # if HAVE_RAW_DECL__EXIT
213 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
214 "use gnulib module _Exit for portability");
215 # endif
216 #endif
219 #if @GNULIB_FREE_POSIX@
220 # if @REPLACE_FREE@
221 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
222 # undef free
223 # define free rpl_free
224 # endif
225 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
226 _GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW);
227 # else
228 _GL_FUNCDECL_RPL (free, void, (void *ptr));
229 # endif
230 _GL_CXXALIAS_RPL (free, void, (void *ptr));
231 # else
232 _GL_CXXALIAS_SYS (free, void, (void *ptr));
233 # endif
234 # if __GLIBC__ >= 2
235 _GL_CXXALIASWARN (free);
236 # endif
237 #elif defined GNULIB_POSIXCHECK
238 # undef free
239 /* Assume free is always declared. */
240 _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
241 "use gnulib module free for portability");
242 #endif
245 /* Allocate memory with indefinite extent and specified alignment. */
246 #if @GNULIB_ALIGNED_ALLOC@
247 # if @REPLACE_ALIGNED_ALLOC@
248 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
249 # undef aligned_alloc
250 # define aligned_alloc rpl_aligned_alloc
251 # endif
252 _GL_FUNCDECL_RPL (aligned_alloc, void *,
253 (size_t alignment, size_t size)
254 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
255 _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
256 # else
257 # if @HAVE_ALIGNED_ALLOC@
258 # if __GNUC__ >= 11
259 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
260 # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
261 _GL_FUNCDECL_SYS (aligned_alloc, void *,
262 (size_t alignment, size_t size)
263 _GL_ATTRIBUTE_NOTHROW
264 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
265 # else
266 _GL_FUNCDECL_SYS (aligned_alloc, void *,
267 (size_t alignment, size_t size)
268 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
269 # endif
270 # endif
271 _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
272 # endif
273 # endif
274 # if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@
275 _GL_CXXALIASWARN (aligned_alloc);
276 # endif
277 #else
278 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc
279 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
280 # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
281 _GL_FUNCDECL_SYS (aligned_alloc, void *,
282 (size_t alignment, size_t size)
283 _GL_ATTRIBUTE_NOTHROW
284 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
285 # else
286 _GL_FUNCDECL_SYS (aligned_alloc, void *,
287 (size_t alignment, size_t size)
288 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
289 # endif
290 # endif
291 # if defined GNULIB_POSIXCHECK
292 # undef aligned_alloc
293 # if HAVE_RAW_DECL_ALIGNED_ALLOC
294 _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
295 "use gnulib module aligned_alloc for portability");
296 # endif
297 # endif
298 #endif
300 #if @GNULIB_ATOLL@
301 /* Parse a signed decimal integer.
302 Returns the value of the integer. Errors are not detected. */
303 # if !@HAVE_ATOLL@
304 _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
305 _GL_ATTRIBUTE_PURE
306 _GL_ARG_NONNULL ((1)));
307 # endif
308 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
309 _GL_CXXALIASWARN (atoll);
310 #elif defined GNULIB_POSIXCHECK
311 # undef atoll
312 # if HAVE_RAW_DECL_ATOLL
313 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
314 "use gnulib module atoll for portability");
315 # endif
316 #endif
318 #if @GNULIB_CALLOC_POSIX@
319 # if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
320 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
321 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
322 # undef calloc
323 # define calloc rpl_calloc
324 # endif
325 _GL_FUNCDECL_RPL (calloc, void *,
326 (size_t nmemb, size_t size)
327 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
328 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
329 # else
330 # if __GNUC__ >= 11
331 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
332 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
333 _GL_FUNCDECL_SYS (calloc, void *,
334 (size_t nmemb, size_t size)
335 _GL_ATTRIBUTE_NOTHROW
336 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
337 # else
338 _GL_FUNCDECL_SYS (calloc, void *,
339 (size_t nmemb, size_t size)
340 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
341 # endif
342 # endif
343 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
344 # endif
345 # if __GLIBC__ >= 2
346 _GL_CXXALIASWARN (calloc);
347 # endif
348 #else
349 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc
350 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
351 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
352 _GL_FUNCDECL_SYS (calloc, void *,
353 (size_t nmemb, size_t size)
354 _GL_ATTRIBUTE_NOTHROW
355 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
356 # else
357 _GL_FUNCDECL_SYS (calloc, void *,
358 (size_t nmemb, size_t size)
359 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
360 # endif
361 # endif
362 # if defined GNULIB_POSIXCHECK
363 # undef calloc
364 /* Assume calloc is always declared. */
365 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
366 "use gnulib module calloc-posix for portability");
367 # endif
368 #endif
370 #if @GNULIB_CANONICALIZE_FILE_NAME@
371 # if @REPLACE_CANONICALIZE_FILE_NAME@
372 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
373 # define canonicalize_file_name rpl_canonicalize_file_name
374 # endif
375 _GL_FUNCDECL_RPL (canonicalize_file_name, char *,
376 (const char *name)
377 _GL_ARG_NONNULL ((1))
378 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
379 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
380 # else
381 # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
382 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
383 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
384 (const char *name)
385 _GL_ATTRIBUTE_NOTHROW
386 _GL_ARG_NONNULL ((1))
387 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
388 # else
389 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
390 (const char *name)
391 _GL_ARG_NONNULL ((1))
392 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
393 # endif
394 # endif
395 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
396 # endif
397 # ifndef GNULIB_defined_canonicalize_file_name
398 # define GNULIB_defined_canonicalize_file_name \
399 (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
400 # endif
401 _GL_CXXALIASWARN (canonicalize_file_name);
402 #else
403 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
404 /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
405 rpl_free. */
406 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
407 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
408 (const char *name)
409 _GL_ATTRIBUTE_NOTHROW
410 _GL_ARG_NONNULL ((1))
411 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
412 # else
413 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
414 (const char *name)
415 _GL_ARG_NONNULL ((1))
416 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
417 # endif
418 # endif
419 # if defined GNULIB_POSIXCHECK
420 # undef canonicalize_file_name
421 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
422 _GL_WARN_ON_USE (canonicalize_file_name,
423 "canonicalize_file_name is unportable - "
424 "use gnulib module canonicalize-lgpl for portability");
425 # endif
426 # endif
427 #endif
429 #if @GNULIB_MDA_ECVT@
430 /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
431 required. In C++ with GNULIB_NAMESPACE, avoid differences between
432 platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
433 it. */
434 # if defined _WIN32 && !defined __CYGWIN__
435 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
436 # undef ecvt
437 # define ecvt _ecvt
438 # endif
439 _GL_CXXALIAS_MDA (ecvt, char *,
440 (double number, int ndigits, int *decptp, int *signp));
441 # else
442 # if @HAVE_DECL_ECVT@
443 _GL_CXXALIAS_SYS (ecvt, char *,
444 (double number, int ndigits, int *decptp, int *signp));
445 # endif
446 # endif
447 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
448 _GL_CXXALIASWARN (ecvt);
449 # endif
450 #endif
452 #if @GNULIB_MDA_FCVT@
453 /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
454 required. In C++ with GNULIB_NAMESPACE, avoid differences between
455 platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
456 it. */
457 # if defined _WIN32 && !defined __CYGWIN__
458 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
459 # undef fcvt
460 # define fcvt _fcvt
461 # endif
462 _GL_CXXALIAS_MDA (fcvt, char *,
463 (double number, int ndigits, int *decptp, int *signp));
464 # else
465 # if @HAVE_DECL_FCVT@
466 _GL_CXXALIAS_SYS (fcvt, char *,
467 (double number, int ndigits, int *decptp, int *signp));
468 # endif
469 # endif
470 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
471 _GL_CXXALIASWARN (fcvt);
472 # endif
473 #endif
475 #if @GNULIB_MDA_GCVT@
476 /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
477 required. In C++ with GNULIB_NAMESPACE, avoid differences between
478 platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
479 it. */
480 # if defined _WIN32 && !defined __CYGWIN__
481 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
482 # undef gcvt
483 # define gcvt _gcvt
484 # endif
485 _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
486 # else
487 # if @HAVE_DECL_GCVT@
488 _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
489 # endif
490 # endif
491 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
492 _GL_CXXALIASWARN (gcvt);
493 # endif
494 #endif
496 #if @GNULIB_GETLOADAVG@
497 /* Store max(NELEM,3) load average numbers in LOADAVG[].
498 The three numbers are the load average of the last 1 minute, the last 5
499 minutes, and the last 15 minutes, respectively.
500 LOADAVG is an array of NELEM numbers. */
501 # if @REPLACE_GETLOADAVG@
502 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
503 # undef getloadavg
504 # define getloadavg rpl_getloadavg
505 # endif
506 _GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem)
507 _GL_ARG_NONNULL ((1)));
508 _GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
509 # else
510 # if !@HAVE_DECL_GETLOADAVG@
511 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
512 _GL_ARG_NONNULL ((1)));
513 # endif
514 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
515 # endif
516 # if __GLIBC__ >= 2
517 _GL_CXXALIASWARN (getloadavg);
518 # endif
519 #elif defined GNULIB_POSIXCHECK
520 # undef getloadavg
521 # if HAVE_RAW_DECL_GETLOADAVG
522 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
523 "use gnulib module getloadavg for portability");
524 # endif
525 #endif
527 #if @GNULIB_GETPROGNAME@
528 /* Return the base name of the executing program.
529 On native Windows this will usually end in ".exe" or ".EXE". */
530 # if @REPLACE_GETPROGNAME@
531 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
532 # undef getprogname
533 # define getprogname rpl_getprogname
534 # endif
535 # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
536 _GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
537 # else
538 _GL_FUNCDECL_RPL (getprogname, const char *, (void));
539 # endif
540 _GL_CXXALIAS_RPL (getprogname, const char *, (void));
541 # else
542 # if !@HAVE_GETPROGNAME@
543 # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
544 _GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
545 # else
546 _GL_FUNCDECL_SYS (getprogname, const char *, (void));
547 # endif
548 # endif
549 _GL_CXXALIAS_SYS (getprogname, const char *, (void));
550 # endif
551 # if __GLIBC__ >= 2
552 _GL_CXXALIASWARN (getprogname);
553 # endif
554 #elif defined GNULIB_POSIXCHECK
555 # undef getprogname
556 # if HAVE_RAW_DECL_GETPROGNAME
557 _GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
558 "use gnulib module getprogname for portability");
559 # endif
560 #endif
562 #if @GNULIB_GETSUBOPT@
563 /* Assuming *OPTIONP is a comma separated list of elements of the form
564 "token" or "token=value", getsubopt parses the first of these elements.
565 If the first element refers to a "token" that is member of the given
566 NULL-terminated array of tokens:
567 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
568 the first option and the comma, sets *VALUEP to the value of the
569 element (or NULL if it doesn't contain an "=" sign),
570 - It returns the index of the "token" in the given array of tokens.
571 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
572 For more details see the POSIX specification.
573 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
574 # if @REPLACE_GETSUBOPT@
575 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
576 # undef getsubopt
577 # define getsubopt rpl_getsubopt
578 # endif
579 _GL_FUNCDECL_RPL (getsubopt, int,
580 (char **optionp, char *const *tokens, char **valuep)
581 _GL_ARG_NONNULL ((1, 2, 3)));
582 _GL_CXXALIAS_RPL (getsubopt, int,
583 (char **optionp, char *const *tokens, char **valuep));
584 # else
585 # if !@HAVE_GETSUBOPT@
586 _GL_FUNCDECL_SYS (getsubopt, int,
587 (char **optionp, char *const *tokens, char **valuep)
588 _GL_ARG_NONNULL ((1, 2, 3)));
589 # endif
590 _GL_CXXALIAS_SYS (getsubopt, int,
591 (char **optionp, char *const *tokens, char **valuep));
592 # endif
593 # if __GLIBC__ >= 2
594 _GL_CXXALIASWARN (getsubopt);
595 # endif
596 #elif defined GNULIB_POSIXCHECK
597 # undef getsubopt
598 # if HAVE_RAW_DECL_GETSUBOPT
599 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
600 "use gnulib module getsubopt for portability");
601 # endif
602 #endif
604 #if @GNULIB_GRANTPT@
605 /* Change the ownership and access permission of the slave side of the
606 pseudo-terminal whose master side is specified by FD. */
607 # if !@HAVE_GRANTPT@
608 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
609 # endif
610 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
611 _GL_CXXALIASWARN (grantpt);
612 #elif defined GNULIB_POSIXCHECK
613 # undef grantpt
614 # if HAVE_RAW_DECL_GRANTPT
615 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
616 "use gnulib module grantpt for portability");
617 # endif
618 #endif
620 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
621 rely on GNU or POSIX semantics for malloc and realloc (for example,
622 by never specifying a zero size), so it does not need malloc or
623 realloc to be redefined. */
624 #if @GNULIB_MALLOC_POSIX@
625 # if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
626 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
627 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
628 || _GL_USE_STDLIB_ALLOC)
629 # undef malloc
630 # define malloc rpl_malloc
631 # endif
632 _GL_FUNCDECL_RPL (malloc, void *,
633 (size_t size)
634 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
635 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
636 # else
637 # if __GNUC__ >= 11
638 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
639 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
640 _GL_FUNCDECL_SYS (malloc, void *,
641 (size_t size)
642 _GL_ATTRIBUTE_NOTHROW
643 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
644 # else
645 _GL_FUNCDECL_SYS (malloc, void *,
646 (size_t size)
647 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
648 # endif
649 # endif
650 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
651 # endif
652 # if __GLIBC__ >= 2
653 _GL_CXXALIASWARN (malloc);
654 # endif
655 #else
656 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc
657 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
658 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
659 _GL_FUNCDECL_SYS (malloc, void *,
660 (size_t size)
661 _GL_ATTRIBUTE_NOTHROW
662 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
663 # else
664 _GL_FUNCDECL_SYS (malloc, void *,
665 (size_t size)
666 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
667 # endif
668 # endif
669 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
670 # undef malloc
671 /* Assume malloc is always declared. */
672 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
673 "use gnulib module malloc-posix for portability");
674 # endif
675 #endif
677 /* Return maximum number of bytes of a multibyte character. */
678 #if @REPLACE_MB_CUR_MAX@
679 # if !GNULIB_defined_MB_CUR_MAX
680 static inline
681 int gl_MB_CUR_MAX (void)
683 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */
684 return MB_CUR_MAX + (MB_CUR_MAX == 3);
686 # undef MB_CUR_MAX
687 # define MB_CUR_MAX gl_MB_CUR_MAX ()
688 # define GNULIB_defined_MB_CUR_MAX 1
689 # endif
690 #endif
692 /* Convert a string to a wide string. */
693 #if @GNULIB_MBSTOWCS@
694 # if @REPLACE_MBSTOWCS@
695 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
696 # undef mbstowcs
697 # define mbstowcs rpl_mbstowcs
698 # endif
699 _GL_FUNCDECL_RPL (mbstowcs, size_t,
700 (wchar_t *restrict dest, const char *restrict src,
701 size_t len)
702 _GL_ARG_NONNULL ((2)));
703 _GL_CXXALIAS_RPL (mbstowcs, size_t,
704 (wchar_t *restrict dest, const char *restrict src,
705 size_t len));
706 # else
707 _GL_CXXALIAS_SYS (mbstowcs, size_t,
708 (wchar_t *restrict dest, const char *restrict src,
709 size_t len));
710 # endif
711 # if __GLIBC__ >= 2
712 _GL_CXXALIASWARN (mbstowcs);
713 # endif
714 #elif defined GNULIB_POSIXCHECK
715 # undef mbstowcs
716 # if HAVE_RAW_DECL_MBSTOWCS
717 _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
718 "use gnulib module mbstowcs for portability");
719 # endif
720 #endif
722 /* Convert a multibyte character to a wide character. */
723 #if @GNULIB_MBTOWC@
724 # if @REPLACE_MBTOWC@
725 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
726 # undef mbtowc
727 # define mbtowc rpl_mbtowc
728 # endif
729 _GL_FUNCDECL_RPL (mbtowc, int,
730 (wchar_t *restrict pwc, const char *restrict s, size_t n));
731 _GL_CXXALIAS_RPL (mbtowc, int,
732 (wchar_t *restrict pwc, const char *restrict s, size_t n));
733 # else
734 # if !@HAVE_MBTOWC@
735 _GL_FUNCDECL_SYS (mbtowc, int,
736 (wchar_t *restrict pwc, const char *restrict s, size_t n));
737 # endif
738 _GL_CXXALIAS_SYS (mbtowc, int,
739 (wchar_t *restrict pwc, const char *restrict s, size_t n));
740 # endif
741 # if __GLIBC__ >= 2
742 _GL_CXXALIASWARN (mbtowc);
743 # endif
744 #elif defined GNULIB_POSIXCHECK
745 # undef mbtowc
746 # if HAVE_RAW_DECL_MBTOWC
747 _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
748 "use gnulib module mbtowc for portability");
749 # endif
750 #endif
752 #if @GNULIB_MKDTEMP@
753 /* Create a unique temporary directory from TEMPLATE.
754 The last six characters of TEMPLATE must be "XXXXXX";
755 they are replaced with a string that makes the directory name unique.
756 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
757 The directory is created mode 700. */
758 # if !@HAVE_MKDTEMP@
759 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
760 # endif
761 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
762 _GL_CXXALIASWARN (mkdtemp);
763 #elif defined GNULIB_POSIXCHECK
764 # undef mkdtemp
765 # if HAVE_RAW_DECL_MKDTEMP
766 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
767 "use gnulib module mkdtemp for portability");
768 # endif
769 #endif
771 #if @GNULIB_MKOSTEMP@
772 /* Create a unique temporary file from TEMPLATE.
773 The last six characters of TEMPLATE must be "XXXXXX";
774 they are replaced with a string that makes the file name unique.
775 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
776 and O_TEXT, O_BINARY (defined in "binary-io.h").
777 The file is then created, with the specified flags, ensuring it didn't exist
778 before.
779 The file is created read-write (mask at least 0600 & ~umask), but it may be
780 world-readable and world-writable (mask 0666 & ~umask), depending on the
781 implementation.
782 Returns the open file descriptor if successful, otherwise -1 and errno
783 set. */
784 # if @REPLACE_MKOSTEMP@
785 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
786 # undef mkostemp
787 # define mkostemp rpl_mkostemp
788 # endif
789 _GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)
790 _GL_ARG_NONNULL ((1)));
791 _GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/));
792 # else
793 # if !@HAVE_MKOSTEMP@
794 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
795 _GL_ARG_NONNULL ((1)));
796 # endif
797 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
798 # endif
799 # if __GLIBC__ >= 2
800 _GL_CXXALIASWARN (mkostemp);
801 # endif
802 #elif defined GNULIB_POSIXCHECK
803 # undef mkostemp
804 # if HAVE_RAW_DECL_MKOSTEMP
805 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
806 "use gnulib module mkostemp for portability");
807 # endif
808 #endif
810 #if @GNULIB_MKOSTEMPS@
811 /* Create a unique temporary file from TEMPLATE.
812 The last six characters of TEMPLATE before a suffix of length
813 SUFFIXLEN must be "XXXXXX";
814 they are replaced with a string that makes the file name unique.
815 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
816 and O_TEXT, O_BINARY (defined in "binary-io.h").
817 The file is then created, with the specified flags, ensuring it didn't exist
818 before.
819 The file is created read-write (mask at least 0600 & ~umask), but it may be
820 world-readable and world-writable (mask 0666 & ~umask), depending on the
821 implementation.
822 Returns the open file descriptor if successful, otherwise -1 and errno
823 set. */
824 # if @REPLACE_MKOSTEMPS@
825 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
826 # undef mkostemps
827 # define mkostemps rpl_mkostemps
828 # endif
829 _GL_FUNCDECL_RPL (mkostemps, int,
830 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
831 _GL_ARG_NONNULL ((1)));
832 _GL_CXXALIAS_RPL (mkostemps, int,
833 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
834 # else
835 # if !@HAVE_MKOSTEMPS@
836 _GL_FUNCDECL_SYS (mkostemps, int,
837 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
838 _GL_ARG_NONNULL ((1)));
839 # endif
840 _GL_CXXALIAS_SYS (mkostemps, int,
841 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
842 # endif
843 # if __GLIBC__ >= 2
844 _GL_CXXALIASWARN (mkostemps);
845 # endif
846 #elif defined GNULIB_POSIXCHECK
847 # undef mkostemps
848 # if HAVE_RAW_DECL_MKOSTEMPS
849 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
850 "use gnulib module mkostemps for portability");
851 # endif
852 #endif
854 #if @GNULIB_MKSTEMP@
855 /* Create a unique temporary file from TEMPLATE.
856 The last six characters of TEMPLATE must be "XXXXXX";
857 they are replaced with a string that makes the file name unique.
858 The file is then created, ensuring it didn't exist before.
859 The file is created read-write (mask at least 0600 & ~umask), but it may be
860 world-readable and world-writable (mask 0666 & ~umask), depending on the
861 implementation.
862 Returns the open file descriptor if successful, otherwise -1 and errno
863 set. */
864 # if @REPLACE_MKSTEMP@
865 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
866 # define mkstemp rpl_mkstemp
867 # endif
868 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
869 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
870 # else
871 # if ! @HAVE_MKSTEMP@
872 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
873 # endif
874 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
875 # endif
876 _GL_CXXALIASWARN (mkstemp);
877 #elif defined GNULIB_POSIXCHECK
878 # undef mkstemp
879 # if HAVE_RAW_DECL_MKSTEMP
880 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
881 "use gnulib module mkstemp for portability");
882 # endif
883 #endif
885 #if @GNULIB_MKSTEMPS@
886 /* Create a unique temporary file from TEMPLATE.
887 The last six characters of TEMPLATE prior to a suffix of length
888 SUFFIXLEN must be "XXXXXX";
889 they are replaced with a string that makes the file name unique.
890 The file is then created, ensuring it didn't exist before.
891 The file is created read-write (mask at least 0600 & ~umask), but it may be
892 world-readable and world-writable (mask 0666 & ~umask), depending on the
893 implementation.
894 Returns the open file descriptor if successful, otherwise -1 and errno
895 set. */
896 # if !@HAVE_MKSTEMPS@
897 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
898 _GL_ARG_NONNULL ((1)));
899 # endif
900 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
901 _GL_CXXALIASWARN (mkstemps);
902 #elif defined GNULIB_POSIXCHECK
903 # undef mkstemps
904 # if HAVE_RAW_DECL_MKSTEMPS
905 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
906 "use gnulib module mkstemps for portability");
907 # endif
908 #endif
910 #if @GNULIB_MDA_MKTEMP@
911 /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
912 required. In C++ with GNULIB_NAMESPACE, avoid differences between
913 platforms by defining GNULIB_NAMESPACE::mktemp always. */
914 # if defined _WIN32 && !defined __CYGWIN__
915 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
916 # undef mktemp
917 # define mktemp _mktemp
918 # endif
919 _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
920 # else
921 _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
922 # endif
923 _GL_CXXALIASWARN (mktemp);
924 #endif
926 /* Allocate memory with indefinite extent and specified alignment. */
927 #if @GNULIB_POSIX_MEMALIGN@
928 # if @REPLACE_POSIX_MEMALIGN@
929 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
930 # undef posix_memalign
931 # define posix_memalign rpl_posix_memalign
932 # endif
933 _GL_FUNCDECL_RPL (posix_memalign, int,
934 (void **memptr, size_t alignment, size_t size)
935 _GL_ARG_NONNULL ((1)));
936 _GL_CXXALIAS_RPL (posix_memalign, int,
937 (void **memptr, size_t alignment, size_t size));
938 # else
939 # if @HAVE_POSIX_MEMALIGN@
940 _GL_CXXALIAS_SYS (posix_memalign, int,
941 (void **memptr, size_t alignment, size_t size));
942 # endif
943 # endif
944 # if __GLIBC__ >= 2 && @HAVE_POSIX_MEMALIGN@
945 _GL_CXXALIASWARN (posix_memalign);
946 # endif
947 #elif defined GNULIB_POSIXCHECK
948 # undef posix_memalign
949 # if HAVE_RAW_DECL_POSIX_MEMALIGN
950 _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
951 "use gnulib module posix_memalign for portability");
952 # endif
953 #endif
955 #if @GNULIB_POSIX_OPENPT@
956 /* Return an FD open to the master side of a pseudo-terminal. Flags should
957 include O_RDWR, and may also include O_NOCTTY. */
958 # if @REPLACE_POSIX_OPENPT@
959 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
960 # undef posix_openpt
961 # define posix_openpt rpl_posix_openpt
962 # endif
963 _GL_FUNCDECL_RPL (posix_openpt, int, (int flags));
964 _GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
965 # else
966 # if !@HAVE_POSIX_OPENPT@
967 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
968 # endif
969 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
970 # endif
971 # if __GLIBC__ >= 2
972 _GL_CXXALIASWARN (posix_openpt);
973 # endif
974 #elif defined GNULIB_POSIXCHECK
975 # undef posix_openpt
976 # if HAVE_RAW_DECL_POSIX_OPENPT
977 _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
978 "use gnulib module posix_openpt for portability");
979 # endif
980 #endif
982 #if @GNULIB_PTSNAME@
983 /* Return the pathname of the pseudo-terminal slave associated with
984 the master FD is open on, or NULL on errors. */
985 # if @REPLACE_PTSNAME@
986 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
987 # undef ptsname
988 # define ptsname rpl_ptsname
989 # endif
990 _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
991 _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
992 # else
993 # if !@HAVE_PTSNAME@
994 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
995 # endif
996 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
997 # endif
998 _GL_CXXALIASWARN (ptsname);
999 #elif defined GNULIB_POSIXCHECK
1000 # undef ptsname
1001 # if HAVE_RAW_DECL_PTSNAME
1002 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
1003 "use gnulib module ptsname for portability");
1004 # endif
1005 #endif
1007 #if @GNULIB_PTSNAME_R@
1008 /* Set the pathname of the pseudo-terminal slave associated with
1009 the master FD is open on and return 0, or set errno and return
1010 non-zero on errors. */
1011 # if @REPLACE_PTSNAME_R@
1012 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1013 # undef ptsname_r
1014 # define ptsname_r rpl_ptsname_r
1015 # endif
1016 _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
1017 _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
1018 # else
1019 # if !@HAVE_PTSNAME_R@
1020 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1021 # endif
1022 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1023 # endif
1024 # ifndef GNULIB_defined_ptsname_r
1025 # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
1026 # endif
1027 _GL_CXXALIASWARN (ptsname_r);
1028 #elif defined GNULIB_POSIXCHECK
1029 # undef ptsname_r
1030 # if HAVE_RAW_DECL_PTSNAME_R
1031 _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
1032 "use gnulib module ptsname_r for portability");
1033 # endif
1034 #endif
1036 #if @GNULIB_PUTENV@
1037 # if @REPLACE_PUTENV@
1038 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1039 # undef putenv
1040 # define putenv rpl_putenv
1041 # endif
1042 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
1043 _GL_CXXALIAS_RPL (putenv, int, (char *string));
1044 # elif defined _WIN32 && !defined __CYGWIN__
1045 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1046 # undef putenv
1047 # define putenv _putenv
1048 # endif
1049 _GL_CXXALIAS_MDA (putenv, int, (char *string));
1050 # elif defined __KLIBC__
1051 /* Need to cast, because on OS/2 kLIBC, the first parameter is
1052 const char *string. */
1053 _GL_CXXALIAS_SYS_CAST (putenv, int, (char *string));
1054 # else
1055 _GL_CXXALIAS_SYS (putenv, int, (char *string));
1056 # endif
1057 _GL_CXXALIASWARN (putenv);
1058 #elif @GNULIB_MDA_PUTENV@
1059 /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
1060 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1061 platforms by defining GNULIB_NAMESPACE::putenv always. */
1062 # if defined _WIN32 && !defined __CYGWIN__
1063 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1064 # undef putenv
1065 # define putenv _putenv
1066 # endif
1067 /* Need to cast, because on mingw, the parameter is either
1068 'const char *string' or 'char *string'. */
1069 _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
1070 # elif defined __KLIBC__
1071 /* Need to cast, because on OS/2 kLIBC, the first parameter is
1072 const char *string. */
1073 _GL_CXXALIAS_SYS_CAST (putenv, int, (char *string));
1074 # else
1075 _GL_CXXALIAS_SYS (putenv, int, (char *string));
1076 # endif
1077 _GL_CXXALIASWARN (putenv);
1078 #endif
1080 #if @GNULIB_QSORT_R@
1081 /* Sort an array of NMEMB elements, starting at address BASE, each element
1082 occupying SIZE bytes, in ascending order according to the comparison
1083 function COMPARE. */
1084 # ifdef __cplusplus
1085 extern "C" {
1086 # endif
1087 # if !GNULIB_defined_qsort_r_fn_types
1088 typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
1089 # define GNULIB_defined_qsort_r_fn_types 1
1090 # endif
1091 # ifdef __cplusplus
1093 # endif
1094 # if @REPLACE_QSORT_R@
1095 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1096 # undef qsort_r
1097 # define qsort_r rpl_qsort_r
1098 # endif
1099 _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1100 _gl_qsort_r_compar_fn compare,
1101 void *arg) _GL_ARG_NONNULL ((1, 4)));
1102 _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1103 _gl_qsort_r_compar_fn compare,
1104 void *arg));
1105 # else
1106 # if !@HAVE_QSORT_R@
1107 _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1108 _gl_qsort_r_compar_fn compare,
1109 void *arg) _GL_ARG_NONNULL ((1, 4)));
1110 # endif
1111 _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1112 _gl_qsort_r_compar_fn compare,
1113 void *arg));
1114 # endif
1115 # if __GLIBC__ >= 2
1116 _GL_CXXALIASWARN (qsort_r);
1117 # endif
1118 #elif defined GNULIB_POSIXCHECK
1119 # undef qsort_r
1120 # if HAVE_RAW_DECL_QSORT_R
1121 _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
1122 "use gnulib module qsort_r for portability");
1123 # endif
1124 #endif
1127 #if @GNULIB_RAND@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@)
1128 # ifndef RAND_MAX
1129 # define RAND_MAX 2147483647
1130 # endif
1131 #endif
1134 #if @GNULIB_RAND@
1135 # if @REPLACE_RAND@
1136 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1137 # undef rand
1138 # define rand rpl_rand
1139 # endif
1140 _GL_FUNCDECL_RPL (rand, int, (void));
1141 _GL_CXXALIAS_RPL (rand, int, (void));
1142 # else
1143 _GL_CXXALIAS_SYS (rand, int, (void));
1144 # endif
1145 # if __GLIBC__ >= 2
1146 _GL_CXXALIASWARN (rand);
1147 # endif
1148 #endif
1151 #if @GNULIB_RANDOM@
1152 # if @REPLACE_RANDOM@
1153 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1154 # undef random
1155 # define random rpl_random
1156 # endif
1157 _GL_FUNCDECL_RPL (random, long, (void));
1158 _GL_CXXALIAS_RPL (random, long, (void));
1159 # else
1160 # if !@HAVE_RANDOM@
1161 _GL_FUNCDECL_SYS (random, long, (void));
1162 # endif
1163 /* Need to cast, because on Haiku, the return type is
1164 int. */
1165 _GL_CXXALIAS_SYS_CAST (random, long, (void));
1166 # endif
1167 # if __GLIBC__ >= 2
1168 _GL_CXXALIASWARN (random);
1169 # endif
1170 #elif defined GNULIB_POSIXCHECK
1171 # undef random
1172 # if HAVE_RAW_DECL_RANDOM
1173 _GL_WARN_ON_USE (random, "random is unportable - "
1174 "use gnulib module random for portability");
1175 # endif
1176 #endif
1178 #if @GNULIB_RANDOM@
1179 # if @REPLACE_RANDOM@
1180 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1181 # undef srandom
1182 # define srandom rpl_srandom
1183 # endif
1184 _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
1185 _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
1186 # else
1187 # if !@HAVE_RANDOM@
1188 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
1189 # endif
1190 /* Need to cast, because on FreeBSD, the first parameter is
1191 unsigned long seed. */
1192 _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
1193 # endif
1194 # if __GLIBC__ >= 2
1195 _GL_CXXALIASWARN (srandom);
1196 # endif
1197 #elif defined GNULIB_POSIXCHECK
1198 # undef srandom
1199 # if HAVE_RAW_DECL_SRANDOM
1200 _GL_WARN_ON_USE (srandom, "srandom is unportable - "
1201 "use gnulib module random for portability");
1202 # endif
1203 #endif
1205 #if @GNULIB_RANDOM@
1206 # if @REPLACE_INITSTATE@
1207 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1208 # undef initstate
1209 # define initstate rpl_initstate
1210 # endif
1211 _GL_FUNCDECL_RPL (initstate, char *,
1212 (unsigned int seed, char *buf, size_t buf_size)
1213 _GL_ARG_NONNULL ((2)));
1214 _GL_CXXALIAS_RPL (initstate, char *,
1215 (unsigned int seed, char *buf, size_t buf_size));
1216 # else
1217 # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
1218 _GL_FUNCDECL_SYS (initstate, char *,
1219 (unsigned int seed, char *buf, size_t buf_size)
1220 _GL_ARG_NONNULL ((2)));
1221 # endif
1222 /* Need to cast, because on FreeBSD, the first parameter is
1223 unsigned long seed. */
1224 _GL_CXXALIAS_SYS_CAST (initstate, char *,
1225 (unsigned int seed, char *buf, size_t buf_size));
1226 # endif
1227 # if __GLIBC__ >= 2
1228 _GL_CXXALIASWARN (initstate);
1229 # endif
1230 #elif defined GNULIB_POSIXCHECK
1231 # undef initstate
1232 # if HAVE_RAW_DECL_INITSTATE
1233 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
1234 "use gnulib module random for portability");
1235 # endif
1236 #endif
1238 #if @GNULIB_RANDOM@
1239 # if @REPLACE_SETSTATE@
1240 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1241 # undef setstate
1242 # define setstate rpl_setstate
1243 # endif
1244 _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1245 _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
1246 # else
1247 # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
1248 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1249 # endif
1250 /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
1251 is const char *arg_state. */
1252 _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
1253 # endif
1254 # if __GLIBC__ >= 2
1255 _GL_CXXALIASWARN (setstate);
1256 # endif
1257 #elif defined GNULIB_POSIXCHECK
1258 # undef setstate
1259 # if HAVE_RAW_DECL_SETSTATE
1260 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
1261 "use gnulib module random for portability");
1262 # endif
1263 #endif
1266 #if @GNULIB_RANDOM_R@
1267 # if @REPLACE_RANDOM_R@
1268 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1269 # undef random_r
1270 # define random_r rpl_random_r
1271 # endif
1272 _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
1273 _GL_ARG_NONNULL ((1, 2)));
1274 _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1275 # else
1276 # if !@HAVE_RANDOM_R@
1277 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
1278 _GL_ARG_NONNULL ((1, 2)));
1279 # endif
1280 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
1281 # endif
1282 _GL_CXXALIASWARN (random_r);
1283 #elif defined GNULIB_POSIXCHECK
1284 # undef random_r
1285 # if HAVE_RAW_DECL_RANDOM_R
1286 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1287 "use gnulib module random_r for portability");
1288 # endif
1289 #endif
1291 #if @GNULIB_RANDOM_R@
1292 # if @REPLACE_RANDOM_R@
1293 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1294 # undef srandom_r
1295 # define srandom_r rpl_srandom_r
1296 # endif
1297 _GL_FUNCDECL_RPL (srandom_r, int,
1298 (unsigned int seed, struct random_data *rand_state)
1299 _GL_ARG_NONNULL ((2)));
1300 _GL_CXXALIAS_RPL (srandom_r, int,
1301 (unsigned int seed, struct random_data *rand_state));
1302 # else
1303 # if !@HAVE_RANDOM_R@
1304 _GL_FUNCDECL_SYS (srandom_r, int,
1305 (unsigned int seed, struct random_data *rand_state)
1306 _GL_ARG_NONNULL ((2)));
1307 # endif
1308 _GL_CXXALIAS_SYS (srandom_r, int,
1309 (unsigned int seed, struct random_data *rand_state));
1310 # endif
1311 _GL_CXXALIASWARN (srandom_r);
1312 #elif defined GNULIB_POSIXCHECK
1313 # undef srandom_r
1314 # if HAVE_RAW_DECL_SRANDOM_R
1315 _GL_WARN_ON_USE (srandom_r, "srandom_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 initstate_r
1324 # define initstate_r rpl_initstate_r
1325 # endif
1326 _GL_FUNCDECL_RPL (initstate_r, int,
1327 (unsigned int seed, char *buf, size_t buf_size,
1328 struct random_data *rand_state)
1329 _GL_ARG_NONNULL ((2, 4)));
1330 _GL_CXXALIAS_RPL (initstate_r, int,
1331 (unsigned int seed, char *buf, size_t buf_size,
1332 struct random_data *rand_state));
1333 # else
1334 # if !@HAVE_RANDOM_R@
1335 _GL_FUNCDECL_SYS (initstate_r, int,
1336 (unsigned int seed, char *buf, size_t buf_size,
1337 struct random_data *rand_state)
1338 _GL_ARG_NONNULL ((2, 4)));
1339 # endif
1340 /* Need to cast, because on Haiku, the third parameter is
1341 unsigned long buf_size. */
1342 _GL_CXXALIAS_SYS_CAST (initstate_r, int,
1343 (unsigned int seed, char *buf, size_t buf_size,
1344 struct random_data *rand_state));
1345 # endif
1346 _GL_CXXALIASWARN (initstate_r);
1347 #elif defined GNULIB_POSIXCHECK
1348 # undef initstate_r
1349 # if HAVE_RAW_DECL_INITSTATE_R
1350 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1351 "use gnulib module random_r for portability");
1352 # endif
1353 #endif
1355 #if @GNULIB_RANDOM_R@
1356 # if @REPLACE_RANDOM_R@
1357 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1358 # undef setstate_r
1359 # define setstate_r rpl_setstate_r
1360 # endif
1361 _GL_FUNCDECL_RPL (setstate_r, int,
1362 (char *arg_state, struct random_data *rand_state)
1363 _GL_ARG_NONNULL ((1, 2)));
1364 _GL_CXXALIAS_RPL (setstate_r, int,
1365 (char *arg_state, struct random_data *rand_state));
1366 # else
1367 # if !@HAVE_RANDOM_R@
1368 _GL_FUNCDECL_SYS (setstate_r, int,
1369 (char *arg_state, struct random_data *rand_state)
1370 _GL_ARG_NONNULL ((1, 2)));
1371 # endif
1372 /* Need to cast, because on Haiku, the first parameter is
1373 void *arg_state. */
1374 _GL_CXXALIAS_SYS_CAST (setstate_r, int,
1375 (char *arg_state, struct random_data *rand_state));
1376 # endif
1377 _GL_CXXALIASWARN (setstate_r);
1378 #elif defined GNULIB_POSIXCHECK
1379 # undef setstate_r
1380 # if HAVE_RAW_DECL_SETSTATE_R
1381 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1382 "use gnulib module random_r for portability");
1383 # endif
1384 #endif
1387 #if @GNULIB_REALLOC_POSIX@
1388 # if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
1389 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
1390 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1391 || _GL_USE_STDLIB_ALLOC)
1392 # undef realloc
1393 # define realloc rpl_realloc
1394 # endif
1395 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
1396 _GL_ATTRIBUTE_DEALLOC_FREE);
1397 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1398 # else
1399 # if __GNUC__ >= 11
1400 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1401 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1402 _GL_FUNCDECL_SYS (realloc, void *,
1403 (void *ptr, size_t size)
1404 _GL_ATTRIBUTE_NOTHROW
1405 _GL_ATTRIBUTE_DEALLOC_FREE);
1406 # else
1407 _GL_FUNCDECL_SYS (realloc, void *,
1408 (void *ptr, size_t size)
1409 _GL_ATTRIBUTE_DEALLOC_FREE);
1410 # endif
1411 # endif
1412 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1413 # endif
1414 # if __GLIBC__ >= 2
1415 _GL_CXXALIASWARN (realloc);
1416 # endif
1417 #else
1418 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
1419 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1420 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1421 _GL_FUNCDECL_SYS (realloc, void *,
1422 (void *ptr, size_t size)
1423 _GL_ATTRIBUTE_NOTHROW
1424 _GL_ATTRIBUTE_DEALLOC_FREE);
1425 # else
1426 _GL_FUNCDECL_SYS (realloc, void *,
1427 (void *ptr, size_t size)
1428 _GL_ATTRIBUTE_DEALLOC_FREE);
1429 # endif
1430 # endif
1431 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1432 # undef realloc
1433 /* Assume realloc is always declared. */
1434 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1435 "use gnulib module realloc-posix for portability");
1436 # endif
1437 #endif
1440 #if @GNULIB_REALLOCARRAY@
1441 # if @REPLACE_REALLOCARRAY@
1442 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1443 # undef reallocarray
1444 # define reallocarray rpl_reallocarray
1445 # endif
1446 _GL_FUNCDECL_RPL (reallocarray, void *,
1447 (void *ptr, size_t nmemb, size_t size));
1448 _GL_CXXALIAS_RPL (reallocarray, void *,
1449 (void *ptr, size_t nmemb, size_t size));
1450 # else
1451 # if ! @HAVE_REALLOCARRAY@
1452 _GL_FUNCDECL_SYS (reallocarray, void *,
1453 (void *ptr, size_t nmemb, size_t size));
1454 # endif
1455 _GL_CXXALIAS_SYS (reallocarray, void *,
1456 (void *ptr, size_t nmemb, size_t size));
1457 # endif
1458 # if __GLIBC__ >= 2
1459 _GL_CXXALIASWARN (reallocarray);
1460 # endif
1461 #elif defined GNULIB_POSIXCHECK
1462 # undef reallocarray
1463 # if HAVE_RAW_DECL_REALLOCARRAY
1464 _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1465 "use gnulib module reallocarray for portability");
1466 # endif
1467 #endif
1469 #if @GNULIB_REALPATH@
1470 # if @REPLACE_REALPATH@
1471 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1472 # define realpath rpl_realpath
1473 # endif
1474 _GL_FUNCDECL_RPL (realpath, char *,
1475 (const char *restrict name, char *restrict resolved)
1476 _GL_ARG_NONNULL ((1)));
1477 _GL_CXXALIAS_RPL (realpath, char *,
1478 (const char *restrict name, char *restrict resolved));
1479 # else
1480 # if !@HAVE_REALPATH@
1481 _GL_FUNCDECL_SYS (realpath, char *,
1482 (const char *restrict name, char *restrict resolved)
1483 _GL_ARG_NONNULL ((1)));
1484 # endif
1485 _GL_CXXALIAS_SYS (realpath, char *,
1486 (const char *restrict name, char *restrict resolved));
1487 # endif
1488 _GL_CXXALIASWARN (realpath);
1489 #elif defined GNULIB_POSIXCHECK
1490 # undef realpath
1491 # if HAVE_RAW_DECL_REALPATH
1492 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1493 "canonicalize or canonicalize-lgpl for portability");
1494 # endif
1495 #endif
1497 #if @GNULIB_RPMATCH@
1498 /* Test a user response to a question.
1499 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1500 # if !@HAVE_RPMATCH@
1501 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
1502 # endif
1503 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1504 _GL_CXXALIASWARN (rpmatch);
1505 #elif defined GNULIB_POSIXCHECK
1506 # undef rpmatch
1507 # if HAVE_RAW_DECL_RPMATCH
1508 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1509 "use gnulib module rpmatch for portability");
1510 # endif
1511 #endif
1513 #if @GNULIB_SECURE_GETENV@
1514 /* Look up NAME in the environment, returning 0 in insecure situations. */
1515 # if !@HAVE_SECURE_GETENV@
1516 _GL_FUNCDECL_SYS (secure_getenv, char *,
1517 (char const *name) _GL_ARG_NONNULL ((1)));
1518 # endif
1519 _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1520 _GL_CXXALIASWARN (secure_getenv);
1521 #elif defined GNULIB_POSIXCHECK
1522 # undef secure_getenv
1523 # if HAVE_RAW_DECL_SECURE_GETENV
1524 _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1525 "use gnulib module secure_getenv for portability");
1526 # endif
1527 #endif
1529 #if @GNULIB_SETENV@
1530 /* Set NAME to VALUE in the environment.
1531 If REPLACE is nonzero, overwrite an existing value. */
1532 # if @REPLACE_SETENV@
1533 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1534 # undef setenv
1535 # define setenv rpl_setenv
1536 # endif
1537 _GL_FUNCDECL_RPL (setenv, int,
1538 (const char *name, const char *value, int replace)
1539 _GL_ARG_NONNULL ((1)));
1540 _GL_CXXALIAS_RPL (setenv, int,
1541 (const char *name, const char *value, int replace));
1542 # else
1543 # if !@HAVE_DECL_SETENV@
1544 _GL_FUNCDECL_SYS (setenv, int,
1545 (const char *name, const char *value, int replace)
1546 _GL_ARG_NONNULL ((1)));
1547 # endif
1548 _GL_CXXALIAS_SYS (setenv, int,
1549 (const char *name, const char *value, int replace));
1550 # endif
1551 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
1552 _GL_CXXALIASWARN (setenv);
1553 # endif
1554 #elif defined GNULIB_POSIXCHECK
1555 # undef setenv
1556 # if HAVE_RAW_DECL_SETENV
1557 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1558 "use gnulib module setenv for portability");
1559 # endif
1560 #endif
1562 #if @GNULIB_STRTOD@
1563 /* Parse a double from STRING, updating ENDP if appropriate. */
1564 # if @REPLACE_STRTOD@
1565 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1566 # define strtod rpl_strtod
1567 # endif
1568 # define GNULIB_defined_strtod_function 1
1569 _GL_FUNCDECL_RPL (strtod, double,
1570 (const char *restrict str, char **restrict endp)
1571 _GL_ARG_NONNULL ((1)));
1572 _GL_CXXALIAS_RPL (strtod, double,
1573 (const char *restrict str, char **restrict endp));
1574 # else
1575 # if !@HAVE_STRTOD@
1576 _GL_FUNCDECL_SYS (strtod, double,
1577 (const char *restrict str, char **restrict endp)
1578 _GL_ARG_NONNULL ((1)));
1579 # endif
1580 _GL_CXXALIAS_SYS (strtod, double,
1581 (const char *restrict str, char **restrict endp));
1582 # endif
1583 # if __GLIBC__ >= 2
1584 _GL_CXXALIASWARN (strtod);
1585 # endif
1586 #elif defined GNULIB_POSIXCHECK
1587 # undef strtod
1588 # if HAVE_RAW_DECL_STRTOD
1589 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1590 "use gnulib module strtod for portability");
1591 # endif
1592 #endif
1594 #if @GNULIB_STRTOF@
1595 /* Parse a float from STRING, updating ENDP if appropriate. */
1596 # if @REPLACE_STRTOF@
1597 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1598 # define strtof rpl_strtof
1599 # endif
1600 # define GNULIB_defined_strtof_function 1
1601 _GL_FUNCDECL_RPL (strtof, float,
1602 (const char *restrict str, char **restrict endp)
1603 _GL_ARG_NONNULL ((1)));
1604 _GL_CXXALIAS_RPL (strtof, float,
1605 (const char *restrict str, char **restrict endp));
1606 # else
1607 # if !@HAVE_STRTOF@
1608 _GL_FUNCDECL_SYS (strtof, float,
1609 (const char *restrict str, char **restrict endp)
1610 _GL_ARG_NONNULL ((1)));
1611 # endif
1612 _GL_CXXALIAS_SYS (strtof, float,
1613 (const char *restrict str, char **restrict endp));
1614 # endif
1615 # if __GLIBC__ >= 2
1616 _GL_CXXALIASWARN (strtof);
1617 # endif
1618 #elif defined GNULIB_POSIXCHECK
1619 # undef strtof
1620 # if HAVE_RAW_DECL_STRTOF
1621 _GL_WARN_ON_USE (strtof, "strtof is unportable - "
1622 "use gnulib module strtof for portability");
1623 # endif
1624 #endif
1626 #if @GNULIB_STRTOLD@
1627 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
1628 # if @REPLACE_STRTOLD@
1629 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1630 # define strtold rpl_strtold
1631 # endif
1632 # define GNULIB_defined_strtold_function 1
1633 _GL_FUNCDECL_RPL (strtold, long double,
1634 (const char *restrict str, char **restrict endp)
1635 _GL_ARG_NONNULL ((1)));
1636 _GL_CXXALIAS_RPL (strtold, long double,
1637 (const char *restrict str, char **restrict endp));
1638 # else
1639 # if !@HAVE_STRTOLD@
1640 _GL_FUNCDECL_SYS (strtold, long double,
1641 (const char *restrict str, char **restrict endp)
1642 _GL_ARG_NONNULL ((1)));
1643 # endif
1644 _GL_CXXALIAS_SYS (strtold, long double,
1645 (const char *restrict str, char **restrict endp));
1646 # endif
1647 _GL_CXXALIASWARN (strtold);
1648 #elif defined GNULIB_POSIXCHECK
1649 # undef strtold
1650 # if HAVE_RAW_DECL_STRTOLD
1651 _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1652 "use gnulib module strtold for portability");
1653 # endif
1654 #endif
1656 #if @GNULIB_STRTOL@
1657 /* Parse a signed integer whose textual representation starts at STRING.
1658 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1659 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1660 "0x").
1661 If ENDPTR is not NULL, the address of the first byte after the integer is
1662 stored in *ENDPTR.
1663 Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
1664 to ERANGE. */
1665 # if @REPLACE_STRTOL@
1666 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1667 # define strtol rpl_strtol
1668 # endif
1669 # define GNULIB_defined_strtol_function 1
1670 _GL_FUNCDECL_RPL (strtol, long,
1671 (const char *restrict string, char **restrict endptr,
1672 int base)
1673 _GL_ARG_NONNULL ((1)));
1674 _GL_CXXALIAS_RPL (strtol, long,
1675 (const char *restrict string, char **restrict endptr,
1676 int base));
1677 # else
1678 # if !@HAVE_STRTOL@
1679 _GL_FUNCDECL_SYS (strtol, long,
1680 (const char *restrict string, char **restrict endptr,
1681 int base)
1682 _GL_ARG_NONNULL ((1)));
1683 # endif
1684 _GL_CXXALIAS_SYS (strtol, long,
1685 (const char *restrict string, char **restrict endptr,
1686 int base));
1687 # endif
1688 # if __GLIBC__ >= 2
1689 _GL_CXXALIASWARN (strtol);
1690 # endif
1691 #elif defined GNULIB_POSIXCHECK
1692 # undef strtol
1693 # if HAVE_RAW_DECL_STRTOL
1694 _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1695 "use gnulib module strtol for portability");
1696 # endif
1697 #endif
1699 #if @GNULIB_STRTOLL@
1700 /* Parse a signed integer whose textual representation starts at STRING.
1701 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1702 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1703 "0x").
1704 If ENDPTR is not NULL, the address of the first byte after the integer is
1705 stored in *ENDPTR.
1706 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
1707 to ERANGE. */
1708 # if @REPLACE_STRTOLL@
1709 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1710 # define strtoll rpl_strtoll
1711 # endif
1712 # define GNULIB_defined_strtoll_function 1
1713 _GL_FUNCDECL_RPL (strtoll, long long,
1714 (const char *restrict string, char **restrict endptr,
1715 int base)
1716 _GL_ARG_NONNULL ((1)));
1717 _GL_CXXALIAS_RPL (strtoll, long long,
1718 (const char *restrict string, char **restrict endptr,
1719 int base));
1720 # else
1721 # if !@HAVE_STRTOLL@
1722 _GL_FUNCDECL_SYS (strtoll, long long,
1723 (const char *restrict string, char **restrict endptr,
1724 int base)
1725 _GL_ARG_NONNULL ((1)));
1726 # endif
1727 _GL_CXXALIAS_SYS (strtoll, long long,
1728 (const char *restrict string, char **restrict endptr,
1729 int base));
1730 # endif
1731 _GL_CXXALIASWARN (strtoll);
1732 #elif defined GNULIB_POSIXCHECK
1733 # undef strtoll
1734 # if HAVE_RAW_DECL_STRTOLL
1735 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1736 "use gnulib module strtoll for portability");
1737 # endif
1738 #endif
1740 #if @GNULIB_STRTOUL@
1741 /* Parse an unsigned integer whose textual representation starts at STRING.
1742 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1743 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1744 "0x").
1745 If ENDPTR is not NULL, the address of the first byte after the integer is
1746 stored in *ENDPTR.
1747 Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */
1748 # if @REPLACE_STRTOUL@
1749 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1750 # define strtoul rpl_strtoul
1751 # endif
1752 # define GNULIB_defined_strtoul_function 1
1753 _GL_FUNCDECL_RPL (strtoul, unsigned long,
1754 (const char *restrict string, char **restrict endptr,
1755 int base)
1756 _GL_ARG_NONNULL ((1)));
1757 _GL_CXXALIAS_RPL (strtoul, unsigned long,
1758 (const char *restrict string, char **restrict endptr,
1759 int base));
1760 # else
1761 # if !@HAVE_STRTOUL@
1762 _GL_FUNCDECL_SYS (strtoul, unsigned long,
1763 (const char *restrict string, char **restrict endptr,
1764 int base)
1765 _GL_ARG_NONNULL ((1)));
1766 # endif
1767 _GL_CXXALIAS_SYS (strtoul, unsigned long,
1768 (const char *restrict string, char **restrict endptr,
1769 int base));
1770 # endif
1771 # if __GLIBC__ >= 2
1772 _GL_CXXALIASWARN (strtoul);
1773 # endif
1774 #elif defined GNULIB_POSIXCHECK
1775 # undef strtoul
1776 # if HAVE_RAW_DECL_STRTOUL
1777 _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1778 "use gnulib module strtoul for portability");
1779 # endif
1780 #endif
1782 #if @GNULIB_STRTOULL@
1783 /* Parse an unsigned integer whose textual representation starts at STRING.
1784 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1785 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1786 "0x").
1787 If ENDPTR is not NULL, the address of the first byte after the integer is
1788 stored in *ENDPTR.
1789 Upon overflow, the return value is ULLONG_MAX, and errno is set to
1790 ERANGE. */
1791 # if @REPLACE_STRTOULL@
1792 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1793 # define strtoull rpl_strtoull
1794 # endif
1795 # define GNULIB_defined_strtoull_function 1
1796 _GL_FUNCDECL_RPL (strtoull, unsigned long long,
1797 (const char *restrict string, char **restrict endptr,
1798 int base)
1799 _GL_ARG_NONNULL ((1)));
1800 _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1801 (const char *restrict string, char **restrict endptr,
1802 int base));
1803 # else
1804 # if !@HAVE_STRTOULL@
1805 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
1806 (const char *restrict string, char **restrict endptr,
1807 int base)
1808 _GL_ARG_NONNULL ((1)));
1809 # endif
1810 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
1811 (const char *restrict string, char **restrict endptr,
1812 int base));
1813 # endif
1814 _GL_CXXALIASWARN (strtoull);
1815 #elif defined GNULIB_POSIXCHECK
1816 # undef strtoull
1817 # if HAVE_RAW_DECL_STRTOULL
1818 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1819 "use gnulib module strtoull for portability");
1820 # endif
1821 #endif
1823 #if @GNULIB_UNLOCKPT@
1824 /* Unlock the slave side of the pseudo-terminal whose master side is specified
1825 by FD, so that it can be opened. */
1826 # if !@HAVE_UNLOCKPT@
1827 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
1828 # endif
1829 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1830 _GL_CXXALIASWARN (unlockpt);
1831 #elif defined GNULIB_POSIXCHECK
1832 # undef unlockpt
1833 # if HAVE_RAW_DECL_UNLOCKPT
1834 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1835 "use gnulib module unlockpt for portability");
1836 # endif
1837 #endif
1839 #if @GNULIB_UNSETENV@
1840 /* Remove the variable NAME from the environment. */
1841 # if @REPLACE_UNSETENV@
1842 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1843 # undef unsetenv
1844 # define unsetenv rpl_unsetenv
1845 # endif
1846 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1847 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1848 # else
1849 # if !@HAVE_DECL_UNSETENV@
1850 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1851 # endif
1852 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1853 # endif
1854 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
1855 _GL_CXXALIASWARN (unsetenv);
1856 # endif
1857 #elif defined GNULIB_POSIXCHECK
1858 # undef unsetenv
1859 # if HAVE_RAW_DECL_UNSETENV
1860 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1861 "use gnulib module unsetenv for portability");
1862 # endif
1863 #endif
1865 /* Convert a wide character to a multibyte character. */
1866 #if @GNULIB_WCTOMB@
1867 # if @REPLACE_WCTOMB@
1868 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1869 # undef wctomb
1870 # define wctomb rpl_wctomb
1871 # endif
1872 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
1873 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1874 # else
1875 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
1876 # endif
1877 # if __GLIBC__ >= 2
1878 _GL_CXXALIASWARN (wctomb);
1879 # endif
1880 #endif
1883 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1884 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1885 #endif