1 /* A GNU-like <stdlib.h>.
2
3 Copyright (C) 1995, 2001-2004, 2006-2023 Free Software Foundation, Inc.
4
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.
9
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.
14
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/>. */
17
18 #if __GNUC__ >= 3
19 @PRAGMA_SYSTEM_HEADER@
20 #endif
21 @PRAGMA_COLUMNS@
22
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. */
26
27 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
28
29 #else
30 /* Normal invocation convention. */
31
32 #ifndef _@GUARD_PREFIX@_STDLIB_H
33
34 /* The include_next requires a split double-inclusion guard. */
35 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
36
37 #ifndef _@GUARD_PREFIX@_STDLIB_H
38 #define _@GUARD_PREFIX@_STDLIB_H
39
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
46
47 /* NetBSD 5.0 mis-defines NULL. */
48 #include <stddef.h>
49
50 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
51 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
52 # include <sys/wait.h>
53 #endif
54
55 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
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
62
63 /* Native Windows platforms declare _mktemp() in <io.h>. */
64 #if defined _WIN32 && !defined __CYGWIN__
65 # include <io.h>
66 #endif
67
68 #if @GNULIB_RANDOM_R@
69
70 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
71 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
72 'struct random_data'. */
73 # if @HAVE_RANDOM_H@
74 # include <random.h>
75 # endif
76
77 # include <stdint.h>
78
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
84 {
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. */
92 };
93 # define GNULIB_defined_struct_random_data 1
94 # endif
95 # endif
96 #endif
97
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
106
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
117
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
124
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
135
136 /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
137 */
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
157
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
167
168 /* The definition of _Noreturn is copied here. */
169
170 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
171
172 /* The definition of _GL_ARG_NONNULL is copied here. */
173
174 /* The definition of _GL_WARN_ON_USE is copied here. */
175
176
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
189
190
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
217
218
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
243
244
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
299
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
317
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
369
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
428
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
451
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
474
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
495
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
526
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
561
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
603
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
619
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
676
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)
682 {
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);
685 }
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
691
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
721
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
751
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
770
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
809
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
853
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
884
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
909
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
925
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
954
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
981
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
1006
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
1035
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
1079
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
1092 }
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 _GL_CXXALIASWARN (qsort_r);
1116 #elif defined GNULIB_POSIXCHECK
1117 # undef qsort_r
1118 # if HAVE_RAW_DECL_QSORT_R
1119 _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
1120 "use gnulib module qsort_r for portability");
1121 # endif
1122 #endif
1123
1124
1125 #if @GNULIB_RANDOM_R@
1126 # if !@HAVE_RANDOM_R@
1127 # ifndef RAND_MAX
1128 # define RAND_MAX 2147483647
1129 # endif
1130 # endif
1131 #endif
1132
1133
1134 #if @GNULIB_RANDOM@
1135 # if @REPLACE_RANDOM@
1136 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1137 # undef random
1138 # define random rpl_random
1139 # endif
1140 _GL_FUNCDECL_RPL (random, long, (void));
1141 _GL_CXXALIAS_RPL (random, long, (void));
1142 # else
1143 # if !@HAVE_RANDOM@
1144 _GL_FUNCDECL_SYS (random, long, (void));
1145 # endif
1146 /* Need to cast, because on Haiku, the return type is
1147 int. */
1148 _GL_CXXALIAS_SYS_CAST (random, long, (void));
1149 # endif
1150 # if __GLIBC__ >= 2
1151 _GL_CXXALIASWARN (random);
1152 # endif
1153 #elif defined GNULIB_POSIXCHECK
1154 # undef random
1155 # if HAVE_RAW_DECL_RANDOM
1156 _GL_WARN_ON_USE (random, "random is unportable - "
1157 "use gnulib module random for portability");
1158 # endif
1159 #endif
1160
1161 #if @GNULIB_RANDOM@
1162 # if @REPLACE_RANDOM@
1163 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1164 # undef srandom
1165 # define srandom rpl_srandom
1166 # endif
1167 _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
1168 _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
1169 # else
1170 # if !@HAVE_RANDOM@
1171 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
1172 # endif
1173 /* Need to cast, because on FreeBSD, the first parameter is
1174 unsigned long seed. */
1175 _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
1176 # endif
1177 # if __GLIBC__ >= 2
1178 _GL_CXXALIASWARN (srandom);
1179 # endif
1180 #elif defined GNULIB_POSIXCHECK
1181 # undef srandom
1182 # if HAVE_RAW_DECL_SRANDOM
1183 _GL_WARN_ON_USE (srandom, "srandom is unportable - "
1184 "use gnulib module random for portability");
1185 # endif
1186 #endif
1187
1188 #if @GNULIB_RANDOM@
1189 # if @REPLACE_INITSTATE@
1190 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1191 # undef initstate
1192 # define initstate rpl_initstate
1193 # endif
1194 _GL_FUNCDECL_RPL (initstate, char *,
1195 (unsigned int seed, char *buf, size_t buf_size)
1196 _GL_ARG_NONNULL ((2)));
1197 _GL_CXXALIAS_RPL (initstate, char *,
1198 (unsigned int seed, char *buf, size_t buf_size));
1199 # else
1200 # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
1201 _GL_FUNCDECL_SYS (initstate, char *,
1202 (unsigned int seed, char *buf, size_t buf_size)
1203 _GL_ARG_NONNULL ((2)));
1204 # endif
1205 /* Need to cast, because on FreeBSD, the first parameter is
1206 unsigned long seed. */
1207 _GL_CXXALIAS_SYS_CAST (initstate, char *,
1208 (unsigned int seed, char *buf, size_t buf_size));
1209 # endif
1210 # if __GLIBC__ >= 2
1211 _GL_CXXALIASWARN (initstate);
1212 # endif
1213 #elif defined GNULIB_POSIXCHECK
1214 # undef initstate
1215 # if HAVE_RAW_DECL_INITSTATE
1216 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
1217 "use gnulib module random for portability");
1218 # endif
1219 #endif
1220
1221 #if @GNULIB_RANDOM@
1222 # if @REPLACE_SETSTATE@
1223 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1224 # undef setstate
1225 # define setstate rpl_setstate
1226 # endif
1227 _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1228 _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
1229 # else
1230 # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
1231 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1232 # endif
1233 /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
1234 is const char *arg_state. */
1235 _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
1236 # endif
1237 # if __GLIBC__ >= 2
1238 _GL_CXXALIASWARN (setstate);
1239 # endif
1240 #elif defined GNULIB_POSIXCHECK
1241 # undef setstate
1242 # if HAVE_RAW_DECL_SETSTATE
1243 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
1244 "use gnulib module random for portability");
1245 # endif
1246 #endif
1247
1248
1249 #if @GNULIB_RANDOM_R@
1250 # if @REPLACE_RANDOM_R@
1251 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1252 # undef random_r
1253 # define random_r rpl_random_r
1254 # endif
1255 _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
1256 _GL_ARG_NONNULL ((1, 2)));
1257 _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1258 # else
1259 # if !@HAVE_RANDOM_R@
1260 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
1261 _GL_ARG_NONNULL ((1, 2)));
1262 # endif
1263 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
1264 # endif
1265 _GL_CXXALIASWARN (random_r);
1266 #elif defined GNULIB_POSIXCHECK
1267 # undef random_r
1268 # if HAVE_RAW_DECL_RANDOM_R
1269 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1270 "use gnulib module random_r for portability");
1271 # endif
1272 #endif
1273
1274 #if @GNULIB_RANDOM_R@
1275 # if @REPLACE_RANDOM_R@
1276 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1277 # undef srandom_r
1278 # define srandom_r rpl_srandom_r
1279 # endif
1280 _GL_FUNCDECL_RPL (srandom_r, int,
1281 (unsigned int seed, struct random_data *rand_state)
1282 _GL_ARG_NONNULL ((2)));
1283 _GL_CXXALIAS_RPL (srandom_r, int,
1284 (unsigned int seed, struct random_data *rand_state));
1285 # else
1286 # if !@HAVE_RANDOM_R@
1287 _GL_FUNCDECL_SYS (srandom_r, int,
1288 (unsigned int seed, struct random_data *rand_state)
1289 _GL_ARG_NONNULL ((2)));
1290 # endif
1291 _GL_CXXALIAS_SYS (srandom_r, int,
1292 (unsigned int seed, struct random_data *rand_state));
1293 # endif
1294 _GL_CXXALIASWARN (srandom_r);
1295 #elif defined GNULIB_POSIXCHECK
1296 # undef srandom_r
1297 # if HAVE_RAW_DECL_SRANDOM_R
1298 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1299 "use gnulib module random_r for portability");
1300 # endif
1301 #endif
1302
1303 #if @GNULIB_RANDOM_R@
1304 # if @REPLACE_RANDOM_R@
1305 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1306 # undef initstate_r
1307 # define initstate_r rpl_initstate_r
1308 # endif
1309 _GL_FUNCDECL_RPL (initstate_r, int,
1310 (unsigned int seed, char *buf, size_t buf_size,
1311 struct random_data *rand_state)
1312 _GL_ARG_NONNULL ((2, 4)));
1313 _GL_CXXALIAS_RPL (initstate_r, int,
1314 (unsigned int seed, char *buf, size_t buf_size,
1315 struct random_data *rand_state));
1316 # else
1317 # if !@HAVE_RANDOM_R@
1318 _GL_FUNCDECL_SYS (initstate_r, int,
1319 (unsigned int seed, char *buf, size_t buf_size,
1320 struct random_data *rand_state)
1321 _GL_ARG_NONNULL ((2, 4)));
1322 # endif
1323 /* Need to cast, because on Haiku, the third parameter is
1324 unsigned long buf_size. */
1325 _GL_CXXALIAS_SYS_CAST (initstate_r, int,
1326 (unsigned int seed, char *buf, size_t buf_size,
1327 struct random_data *rand_state));
1328 # endif
1329 _GL_CXXALIASWARN (initstate_r);
1330 #elif defined GNULIB_POSIXCHECK
1331 # undef initstate_r
1332 # if HAVE_RAW_DECL_INITSTATE_R
1333 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1334 "use gnulib module random_r for portability");
1335 # endif
1336 #endif
1337
1338 #if @GNULIB_RANDOM_R@
1339 # if @REPLACE_RANDOM_R@
1340 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1341 # undef setstate_r
1342 # define setstate_r rpl_setstate_r
1343 # endif
1344 _GL_FUNCDECL_RPL (setstate_r, int,
1345 (char *arg_state, struct random_data *rand_state)
1346 _GL_ARG_NONNULL ((1, 2)));
1347 _GL_CXXALIAS_RPL (setstate_r, int,
1348 (char *arg_state, struct random_data *rand_state));
1349 # else
1350 # if !@HAVE_RANDOM_R@
1351 _GL_FUNCDECL_SYS (setstate_r, int,
1352 (char *arg_state, struct random_data *rand_state)
1353 _GL_ARG_NONNULL ((1, 2)));
1354 # endif
1355 /* Need to cast, because on Haiku, the first parameter is
1356 void *arg_state. */
1357 _GL_CXXALIAS_SYS_CAST (setstate_r, int,
1358 (char *arg_state, struct random_data *rand_state));
1359 # endif
1360 _GL_CXXALIASWARN (setstate_r);
1361 #elif defined GNULIB_POSIXCHECK
1362 # undef setstate_r
1363 # if HAVE_RAW_DECL_SETSTATE_R
1364 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1365 "use gnulib module random_r for portability");
1366 # endif
1367 #endif
1368
1369
1370 #if @GNULIB_REALLOC_POSIX@
1371 # if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
1372 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
1373 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1374 || _GL_USE_STDLIB_ALLOC)
1375 # undef realloc
1376 # define realloc rpl_realloc
1377 # endif
1378 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
1379 _GL_ATTRIBUTE_DEALLOC_FREE);
1380 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1381 # else
1382 # if __GNUC__ >= 11
1383 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1384 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1385 _GL_FUNCDECL_SYS (realloc, void *,
1386 (void *ptr, size_t size)
1387 _GL_ATTRIBUTE_NOTHROW
1388 _GL_ATTRIBUTE_DEALLOC_FREE);
1389 # else
1390 _GL_FUNCDECL_SYS (realloc, void *,
1391 (void *ptr, size_t size)
1392 _GL_ATTRIBUTE_DEALLOC_FREE);
1393 # endif
1394 # endif
1395 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1396 # endif
1397 # if __GLIBC__ >= 2
1398 _GL_CXXALIASWARN (realloc);
1399 # endif
1400 #else
1401 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
1402 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1403 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1404 _GL_FUNCDECL_SYS (realloc, void *,
1405 (void *ptr, size_t size)
1406 _GL_ATTRIBUTE_NOTHROW
1407 _GL_ATTRIBUTE_DEALLOC_FREE);
1408 # else
1409 _GL_FUNCDECL_SYS (realloc, void *,
1410 (void *ptr, size_t size)
1411 _GL_ATTRIBUTE_DEALLOC_FREE);
1412 # endif
1413 # endif
1414 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1415 # undef realloc
1416 /* Assume realloc is always declared. */
1417 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1418 "use gnulib module realloc-posix for portability");
1419 # endif
1420 #endif
1421
1422
1423 #if @GNULIB_REALLOCARRAY@
1424 # if @REPLACE_REALLOCARRAY@
1425 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1426 # undef reallocarray
1427 # define reallocarray rpl_reallocarray
1428 # endif
1429 _GL_FUNCDECL_RPL (reallocarray, void *,
1430 (void *ptr, size_t nmemb, size_t size));
1431 _GL_CXXALIAS_RPL (reallocarray, void *,
1432 (void *ptr, size_t nmemb, size_t size));
1433 # else
1434 # if ! @HAVE_REALLOCARRAY@
1435 _GL_FUNCDECL_SYS (reallocarray, void *,
1436 (void *ptr, size_t nmemb, size_t size));
1437 # endif
1438 _GL_CXXALIAS_SYS (reallocarray, void *,
1439 (void *ptr, size_t nmemb, size_t size));
1440 # endif
1441 # if __GLIBC__ >= 2
1442 _GL_CXXALIASWARN (reallocarray);
1443 # endif
1444 #elif defined GNULIB_POSIXCHECK
1445 # undef reallocarray
1446 # if HAVE_RAW_DECL_REALLOCARRAY
1447 _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1448 "use gnulib module reallocarray for portability");
1449 # endif
1450 #endif
1451
1452 #if @GNULIB_REALPATH@
1453 # if @REPLACE_REALPATH@
1454 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1455 # define realpath rpl_realpath
1456 # endif
1457 _GL_FUNCDECL_RPL (realpath, char *,
1458 (const char *restrict name, char *restrict resolved)
1459 _GL_ARG_NONNULL ((1)));
1460 _GL_CXXALIAS_RPL (realpath, char *,
1461 (const char *restrict name, char *restrict resolved));
1462 # else
1463 # if !@HAVE_REALPATH@
1464 _GL_FUNCDECL_SYS (realpath, char *,
1465 (const char *restrict name, char *restrict resolved)
1466 _GL_ARG_NONNULL ((1)));
1467 # endif
1468 _GL_CXXALIAS_SYS (realpath, char *,
1469 (const char *restrict name, char *restrict resolved));
1470 # endif
1471 _GL_CXXALIASWARN (realpath);
1472 #elif defined GNULIB_POSIXCHECK
1473 # undef realpath
1474 # if HAVE_RAW_DECL_REALPATH
1475 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1476 "canonicalize or canonicalize-lgpl for portability");
1477 # endif
1478 #endif
1479
1480 #if @GNULIB_RPMATCH@
1481 /* Test a user response to a question.
1482 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1483 # if !@HAVE_RPMATCH@
1484 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
1485 # endif
1486 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1487 _GL_CXXALIASWARN (rpmatch);
1488 #elif defined GNULIB_POSIXCHECK
1489 # undef rpmatch
1490 # if HAVE_RAW_DECL_RPMATCH
1491 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1492 "use gnulib module rpmatch for portability");
1493 # endif
1494 #endif
1495
1496 #if @GNULIB_SECURE_GETENV@
1497 /* Look up NAME in the environment, returning 0 in insecure situations. */
1498 # if !@HAVE_SECURE_GETENV@
1499 _GL_FUNCDECL_SYS (secure_getenv, char *,
1500 (char const *name) _GL_ARG_NONNULL ((1)));
1501 # endif
1502 _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1503 _GL_CXXALIASWARN (secure_getenv);
1504 #elif defined GNULIB_POSIXCHECK
1505 # undef secure_getenv
1506 # if HAVE_RAW_DECL_SECURE_GETENV
1507 _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1508 "use gnulib module secure_getenv for portability");
1509 # endif
1510 #endif
1511
1512 #if @GNULIB_SETENV@
1513 /* Set NAME to VALUE in the environment.
1514 If REPLACE is nonzero, overwrite an existing value. */
1515 # if @REPLACE_SETENV@
1516 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1517 # undef setenv
1518 # define setenv rpl_setenv
1519 # endif
1520 _GL_FUNCDECL_RPL (setenv, int,
1521 (const char *name, const char *value, int replace)
1522 _GL_ARG_NONNULL ((1)));
1523 _GL_CXXALIAS_RPL (setenv, int,
1524 (const char *name, const char *value, int replace));
1525 # else
1526 # if !@HAVE_DECL_SETENV@
1527 _GL_FUNCDECL_SYS (setenv, int,
1528 (const char *name, const char *value, int replace)
1529 _GL_ARG_NONNULL ((1)));
1530 # endif
1531 _GL_CXXALIAS_SYS (setenv, int,
1532 (const char *name, const char *value, int replace));
1533 # endif
1534 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
1535 _GL_CXXALIASWARN (setenv);
1536 # endif
1537 #elif defined GNULIB_POSIXCHECK
1538 # undef setenv
1539 # if HAVE_RAW_DECL_SETENV
1540 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1541 "use gnulib module setenv for portability");
1542 # endif
1543 #endif
1544
1545 #if @GNULIB_STRTOD@
1546 /* Parse a double from STRING, updating ENDP if appropriate. */
1547 # if @REPLACE_STRTOD@
1548 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1549 # define strtod rpl_strtod
1550 # endif
1551 # define GNULIB_defined_strtod_function 1
1552 _GL_FUNCDECL_RPL (strtod, double,
1553 (const char *restrict str, char **restrict endp)
1554 _GL_ARG_NONNULL ((1)));
1555 _GL_CXXALIAS_RPL (strtod, double,
1556 (const char *restrict str, char **restrict endp));
1557 # else
1558 # if !@HAVE_STRTOD@
1559 _GL_FUNCDECL_SYS (strtod, double,
1560 (const char *restrict str, char **restrict endp)
1561 _GL_ARG_NONNULL ((1)));
1562 # endif
1563 _GL_CXXALIAS_SYS (strtod, double,
1564 (const char *restrict str, char **restrict endp));
1565 # endif
1566 # if __GLIBC__ >= 2
1567 _GL_CXXALIASWARN (strtod);
1568 # endif
1569 #elif defined GNULIB_POSIXCHECK
1570 # undef strtod
1571 # if HAVE_RAW_DECL_STRTOD
1572 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1573 "use gnulib module strtod for portability");
1574 # endif
1575 #endif
1576
1577 #if @GNULIB_STRTOLD@
1578 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
1579 # if @REPLACE_STRTOLD@
1580 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1581 # define strtold rpl_strtold
1582 # endif
1583 # define GNULIB_defined_strtold_function 1
1584 _GL_FUNCDECL_RPL (strtold, long double,
1585 (const char *restrict str, char **restrict endp)
1586 _GL_ARG_NONNULL ((1)));
1587 _GL_CXXALIAS_RPL (strtold, long double,
1588 (const char *restrict str, char **restrict endp));
1589 # else
1590 # if !@HAVE_STRTOLD@
1591 _GL_FUNCDECL_SYS (strtold, long double,
1592 (const char *restrict str, char **restrict endp)
1593 _GL_ARG_NONNULL ((1)));
1594 # endif
1595 _GL_CXXALIAS_SYS (strtold, long double,
1596 (const char *restrict str, char **restrict endp));
1597 # endif
1598 _GL_CXXALIASWARN (strtold);
1599 #elif defined GNULIB_POSIXCHECK
1600 # undef strtold
1601 # if HAVE_RAW_DECL_STRTOLD
1602 _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1603 "use gnulib module strtold for portability");
1604 # endif
1605 #endif
1606
1607 #if @GNULIB_STRTOL@
1608 /* Parse a signed integer whose textual representation starts at STRING.
1609 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1610 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1611 "0x").
1612 If ENDPTR is not NULL, the address of the first byte after the integer is
1613 stored in *ENDPTR.
1614 Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
1615 to ERANGE. */
1616 # if @REPLACE_STRTOL@
1617 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1618 # define strtol rpl_strtol
1619 # endif
1620 # define GNULIB_defined_strtol_function 1
1621 _GL_FUNCDECL_RPL (strtol, long,
1622 (const char *restrict string, char **restrict endptr,
1623 int base)
1624 _GL_ARG_NONNULL ((1)));
1625 _GL_CXXALIAS_RPL (strtol, long,
1626 (const char *restrict string, char **restrict endptr,
1627 int base));
1628 # else
1629 # if !@HAVE_STRTOL@
1630 _GL_FUNCDECL_SYS (strtol, long,
1631 (const char *restrict string, char **restrict endptr,
1632 int base)
1633 _GL_ARG_NONNULL ((1)));
1634 # endif
1635 _GL_CXXALIAS_SYS (strtol, long,
1636 (const char *restrict string, char **restrict endptr,
1637 int base));
1638 # endif
1639 # if __GLIBC__ >= 2
1640 _GL_CXXALIASWARN (strtol);
1641 # endif
1642 #elif defined GNULIB_POSIXCHECK
1643 # undef strtol
1644 # if HAVE_RAW_DECL_STRTOL
1645 _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1646 "use gnulib module strtol for portability");
1647 # endif
1648 #endif
1649
1650 #if @GNULIB_STRTOLL@
1651 /* Parse a signed integer whose textual representation starts at STRING.
1652 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1653 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1654 "0x").
1655 If ENDPTR is not NULL, the address of the first byte after the integer is
1656 stored in *ENDPTR.
1657 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
1658 to ERANGE. */
1659 # if @REPLACE_STRTOLL@
1660 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1661 # define strtoll rpl_strtoll
1662 # endif
1663 # define GNULIB_defined_strtoll_function 1
1664 _GL_FUNCDECL_RPL (strtoll, long long,
1665 (const char *restrict string, char **restrict endptr,
1666 int base)
1667 _GL_ARG_NONNULL ((1)));
1668 _GL_CXXALIAS_RPL (strtoll, long long,
1669 (const char *restrict string, char **restrict endptr,
1670 int base));
1671 # else
1672 # if !@HAVE_STRTOLL@
1673 _GL_FUNCDECL_SYS (strtoll, long long,
1674 (const char *restrict string, char **restrict endptr,
1675 int base)
1676 _GL_ARG_NONNULL ((1)));
1677 # endif
1678 _GL_CXXALIAS_SYS (strtoll, long long,
1679 (const char *restrict string, char **restrict endptr,
1680 int base));
1681 # endif
1682 _GL_CXXALIASWARN (strtoll);
1683 #elif defined GNULIB_POSIXCHECK
1684 # undef strtoll
1685 # if HAVE_RAW_DECL_STRTOLL
1686 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1687 "use gnulib module strtoll for portability");
1688 # endif
1689 #endif
1690
1691 #if @GNULIB_STRTOUL@
1692 /* Parse an unsigned integer whose textual representation starts at STRING.
1693 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1694 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1695 "0x").
1696 If ENDPTR is not NULL, the address of the first byte after the integer is
1697 stored in *ENDPTR.
1698 Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */
1699 # if @REPLACE_STRTOUL@
1700 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1701 # define strtoul rpl_strtoul
1702 # endif
1703 # define GNULIB_defined_strtoul_function 1
1704 _GL_FUNCDECL_RPL (strtoul, unsigned long,
1705 (const char *restrict string, char **restrict endptr,
1706 int base)
1707 _GL_ARG_NONNULL ((1)));
1708 _GL_CXXALIAS_RPL (strtoul, unsigned long,
1709 (const char *restrict string, char **restrict endptr,
1710 int base));
1711 # else
1712 # if !@HAVE_STRTOUL@
1713 _GL_FUNCDECL_SYS (strtoul, unsigned long,
1714 (const char *restrict string, char **restrict endptr,
1715 int base)
1716 _GL_ARG_NONNULL ((1)));
1717 # endif
1718 _GL_CXXALIAS_SYS (strtoul, unsigned long,
1719 (const char *restrict string, char **restrict endptr,
1720 int base));
1721 # endif
1722 # if __GLIBC__ >= 2
1723 _GL_CXXALIASWARN (strtoul);
1724 # endif
1725 #elif defined GNULIB_POSIXCHECK
1726 # undef strtoul
1727 # if HAVE_RAW_DECL_STRTOUL
1728 _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1729 "use gnulib module strtoul for portability");
1730 # endif
1731 #endif
1732
1733 #if @GNULIB_STRTOULL@
1734 /* Parse an unsigned integer whose textual representation starts at STRING.
1735 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1736 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1737 "0x").
1738 If ENDPTR is not NULL, the address of the first byte after the integer is
1739 stored in *ENDPTR.
1740 Upon overflow, the return value is ULLONG_MAX, and errno is set to
1741 ERANGE. */
1742 # if @REPLACE_STRTOULL@
1743 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1744 # define strtoull rpl_strtoull
1745 # endif
1746 # define GNULIB_defined_strtoull_function 1
1747 _GL_FUNCDECL_RPL (strtoull, unsigned long long,
1748 (const char *restrict string, char **restrict endptr,
1749 int base)
1750 _GL_ARG_NONNULL ((1)));
1751 _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1752 (const char *restrict string, char **restrict endptr,
1753 int base));
1754 # else
1755 # if !@HAVE_STRTOULL@
1756 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
1757 (const char *restrict string, char **restrict endptr,
1758 int base)
1759 _GL_ARG_NONNULL ((1)));
1760 # endif
1761 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
1762 (const char *restrict string, char **restrict endptr,
1763 int base));
1764 # endif
1765 _GL_CXXALIASWARN (strtoull);
1766 #elif defined GNULIB_POSIXCHECK
1767 # undef strtoull
1768 # if HAVE_RAW_DECL_STRTOULL
1769 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1770 "use gnulib module strtoull for portability");
1771 # endif
1772 #endif
1773
1774 #if @GNULIB_UNLOCKPT@
1775 /* Unlock the slave side of the pseudo-terminal whose master side is specified
1776 by FD, so that it can be opened. */
1777 # if !@HAVE_UNLOCKPT@
1778 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
1779 # endif
1780 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1781 _GL_CXXALIASWARN (unlockpt);
1782 #elif defined GNULIB_POSIXCHECK
1783 # undef unlockpt
1784 # if HAVE_RAW_DECL_UNLOCKPT
1785 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1786 "use gnulib module unlockpt for portability");
1787 # endif
1788 #endif
1789
1790 #if @GNULIB_UNSETENV@
1791 /* Remove the variable NAME from the environment. */
1792 # if @REPLACE_UNSETENV@
1793 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1794 # undef unsetenv
1795 # define unsetenv rpl_unsetenv
1796 # endif
1797 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1798 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1799 # else
1800 # if !@HAVE_DECL_UNSETENV@
1801 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1802 # endif
1803 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1804 # endif
1805 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
1806 _GL_CXXALIASWARN (unsetenv);
1807 # endif
1808 #elif defined GNULIB_POSIXCHECK
1809 # undef unsetenv
1810 # if HAVE_RAW_DECL_UNSETENV
1811 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1812 "use gnulib module unsetenv for portability");
1813 # endif
1814 #endif
1815
1816 /* Convert a wide character to a multibyte character. */
1817 #if @GNULIB_WCTOMB@
1818 # if @REPLACE_WCTOMB@
1819 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1820 # undef wctomb
1821 # define wctomb rpl_wctomb
1822 # endif
1823 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
1824 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1825 # else
1826 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
1827 # endif
1828 # if __GLIBC__ >= 2
1829 _GL_CXXALIASWARN (wctomb);
1830 # endif
1831 #endif
1832
1833
1834 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1835 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1836 #endif