check_rpc: recognize capitalized "Program" in rpcinfo output (fixes #1488)
[monitoring-plugins.git] / gl / stdlib.in.h
blobb79e5f709657b7a650e77d2af910e313cc00828a
1 /* A GNU-like <stdlib.h>.
3 Copyright (C) 1995, 2001-2004, 2006-2023 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 /* NetBSD 5.0 mis-defines NULL. */
41 #include <stddef.h>
43 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
44 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
45 # include <sys/wait.h>
46 #endif
48 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
49 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
50 /* OpenIndiana has a bug: <sys/time.h> must be included before
51 <sys/loadavg.h>. */
52 # include <sys/time.h>
53 # include <sys/loadavg.h>
54 #endif
56 /* Native Windows platforms declare _mktemp() in <io.h>. */
57 #if defined _WIN32 && !defined __CYGWIN__
58 # include <io.h>
59 #endif
61 #if @GNULIB_RANDOM_R@
63 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
64 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
65 'struct random_data'. */
66 # if @HAVE_RANDOM_H@
67 # include <random.h>
68 # endif
70 # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
71 # include <stdint.h>
72 # endif
74 # if !@HAVE_STRUCT_RANDOM_DATA@
75 /* Define 'struct random_data'.
76 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
77 # if !GNULIB_defined_struct_random_data
78 struct random_data
80 int32_t *fptr; /* Front pointer. */
81 int32_t *rptr; /* Rear pointer. */
82 int32_t *state; /* Array of state values. */
83 int rand_type; /* Type of random number generator. */
84 int rand_deg; /* Degree of random number generator. */
85 int rand_sep; /* Distance between front and rear. */
86 int32_t *end_ptr; /* Pointer behind state table. */
88 # define GNULIB_defined_struct_random_data 1
89 # endif
90 # endif
91 #endif
93 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
94 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
95 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
96 /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */
97 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
98 /* But avoid namespace pollution on glibc systems and native Windows. */
99 # include <unistd.h>
100 #endif
102 /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
103 that can be freed by passing them as the Ith argument to the
104 function F. */
105 #ifndef _GL_ATTRIBUTE_DEALLOC
106 # if __GNUC__ >= 11
107 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
108 # else
109 # define _GL_ATTRIBUTE_DEALLOC(f, i)
110 # endif
111 #endif
113 /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
114 can be freed via 'free'; it can be used only after declaring 'free'. */
115 /* Applies to: functions. Cannot be used on inline functions. */
116 #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
117 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
118 #endif
120 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
121 allocated memory. */
122 /* Applies to: functions. */
123 #ifndef _GL_ATTRIBUTE_MALLOC
124 # if __GNUC__ >= 3 || defined __clang__
125 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
126 # else
127 # define _GL_ATTRIBUTE_MALLOC
128 # endif
129 #endif
131 /* The __attribute__ feature is available in gcc versions 2.5 and later.
132 The attribute __pure__ was added in gcc 2.96. */
133 #ifndef _GL_ATTRIBUTE_PURE
134 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
135 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
136 # else
137 # define _GL_ATTRIBUTE_PURE /* empty */
138 # endif
139 #endif
141 /* The definition of _Noreturn is copied here. */
143 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
145 /* The definition of _GL_ARG_NONNULL is copied here. */
147 /* The definition of _GL_WARN_ON_USE is copied here. */
150 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
151 #ifndef EXIT_SUCCESS
152 # define EXIT_SUCCESS 0
153 #endif
154 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
155 with proper operation of xargs. */
156 #ifndef EXIT_FAILURE
157 # define EXIT_FAILURE 1
158 #elif EXIT_FAILURE != 1
159 # undef EXIT_FAILURE
160 # define EXIT_FAILURE 1
161 #endif
164 #if @GNULIB__EXIT@
165 /* Terminate the current process with the given return code, without running
166 the 'atexit' handlers. */
167 # if !@HAVE__EXIT@
168 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
169 # endif
170 _GL_CXXALIAS_SYS (_Exit, void, (int status));
171 _GL_CXXALIASWARN (_Exit);
172 #elif defined GNULIB_POSIXCHECK
173 # undef _Exit
174 # if HAVE_RAW_DECL__EXIT
175 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
176 "use gnulib module _Exit for portability");
177 # endif
178 #endif
181 #if @GNULIB_FREE_POSIX@
182 # if @REPLACE_FREE@
183 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
184 # undef free
185 # define free rpl_free
186 # endif
187 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
188 _GL_FUNCDECL_RPL (free, void, (void *ptr) throw ());
189 # else
190 _GL_FUNCDECL_RPL (free, void, (void *ptr));
191 # endif
192 _GL_CXXALIAS_RPL (free, void, (void *ptr));
193 # else
194 _GL_CXXALIAS_SYS (free, void, (void *ptr));
195 # endif
196 # if __GLIBC__ >= 2
197 _GL_CXXALIASWARN (free);
198 # endif
199 #elif defined GNULIB_POSIXCHECK
200 # undef free
201 /* Assume free is always declared. */
202 _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
203 "use gnulib module free for portability");
204 #endif
207 /* Allocate memory with indefinite extent and specified alignment. */
208 #if @GNULIB_ALIGNED_ALLOC@
209 # if @REPLACE_ALIGNED_ALLOC@
210 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
211 # undef aligned_alloc
212 # define aligned_alloc rpl_aligned_alloc
213 # endif
214 _GL_FUNCDECL_RPL (aligned_alloc, void *,
215 (size_t alignment, size_t size)
216 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
217 _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
218 # else
219 # if @HAVE_ALIGNED_ALLOC@
220 # if __GNUC__ >= 11
221 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
222 _GL_FUNCDECL_SYS (aligned_alloc, void *,
223 (size_t alignment, size_t size)
224 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
225 # endif
226 _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
227 # endif
228 # endif
229 # if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@
230 _GL_CXXALIASWARN (aligned_alloc);
231 # endif
232 #else
233 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc
234 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
235 _GL_FUNCDECL_SYS (aligned_alloc, void *,
236 (size_t alignment, size_t size)
237 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
238 # endif
239 # if defined GNULIB_POSIXCHECK
240 # undef aligned_alloc
241 # if HAVE_RAW_DECL_ALIGNED_ALLOC
242 _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
243 "use gnulib module aligned_alloc for portability");
244 # endif
245 # endif
246 #endif
248 #if @GNULIB_ATOLL@
249 /* Parse a signed decimal integer.
250 Returns the value of the integer. Errors are not detected. */
251 # if !@HAVE_ATOLL@
252 _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
253 _GL_ATTRIBUTE_PURE
254 _GL_ARG_NONNULL ((1)));
255 # endif
256 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
257 _GL_CXXALIASWARN (atoll);
258 #elif defined GNULIB_POSIXCHECK
259 # undef atoll
260 # if HAVE_RAW_DECL_ATOLL
261 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
262 "use gnulib module atoll for portability");
263 # endif
264 #endif
266 #if @GNULIB_CALLOC_POSIX@
267 # if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
268 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
269 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
270 # undef calloc
271 # define calloc rpl_calloc
272 # endif
273 _GL_FUNCDECL_RPL (calloc, void *,
274 (size_t nmemb, size_t size)
275 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
276 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
277 # else
278 # if __GNUC__ >= 11
279 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
280 _GL_FUNCDECL_SYS (calloc, void *,
281 (size_t nmemb, size_t size)
282 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
283 # endif
284 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
285 # endif
286 # if __GLIBC__ >= 2
287 _GL_CXXALIASWARN (calloc);
288 # endif
289 #else
290 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc
291 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
292 _GL_FUNCDECL_SYS (calloc, void *,
293 (size_t nmemb, size_t size)
294 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
295 # endif
296 # if defined GNULIB_POSIXCHECK
297 # undef calloc
298 /* Assume calloc is always declared. */
299 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
300 "use gnulib module calloc-posix for portability");
301 # endif
302 #endif
304 #if @GNULIB_CANONICALIZE_FILE_NAME@
305 # if @REPLACE_CANONICALIZE_FILE_NAME@
306 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
307 # define canonicalize_file_name rpl_canonicalize_file_name
308 # endif
309 _GL_FUNCDECL_RPL (canonicalize_file_name, char *,
310 (const char *name)
311 _GL_ARG_NONNULL ((1))
312 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
313 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
314 # else
315 # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
316 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
317 (const char *name)
318 _GL_ARG_NONNULL ((1))
319 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
320 # endif
321 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
322 # endif
323 # ifndef GNULIB_defined_canonicalize_file_name
324 # define GNULIB_defined_canonicalize_file_name \
325 (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
326 # endif
327 _GL_CXXALIASWARN (canonicalize_file_name);
328 #else
329 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
330 /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
331 rpl_free. */
332 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
333 (const char *name)
334 _GL_ARG_NONNULL ((1))
335 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
336 # endif
337 # if defined GNULIB_POSIXCHECK
338 # undef canonicalize_file_name
339 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
340 _GL_WARN_ON_USE (canonicalize_file_name,
341 "canonicalize_file_name is unportable - "
342 "use gnulib module canonicalize-lgpl for portability");
343 # endif
344 # endif
345 #endif
347 #if @GNULIB_MDA_ECVT@
348 /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
349 required. In C++ with GNULIB_NAMESPACE, avoid differences between
350 platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
351 it. */
352 # if defined _WIN32 && !defined __CYGWIN__
353 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
354 # undef ecvt
355 # define ecvt _ecvt
356 # endif
357 _GL_CXXALIAS_MDA (ecvt, char *,
358 (double number, int ndigits, int *decptp, int *signp));
359 # else
360 # if @HAVE_DECL_ECVT@
361 _GL_CXXALIAS_SYS (ecvt, char *,
362 (double number, int ndigits, int *decptp, int *signp));
363 # endif
364 # endif
365 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
366 _GL_CXXALIASWARN (ecvt);
367 # endif
368 #endif
370 #if @GNULIB_MDA_FCVT@
371 /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
372 required. In C++ with GNULIB_NAMESPACE, avoid differences between
373 platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
374 it. */
375 # if defined _WIN32 && !defined __CYGWIN__
376 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
377 # undef fcvt
378 # define fcvt _fcvt
379 # endif
380 _GL_CXXALIAS_MDA (fcvt, char *,
381 (double number, int ndigits, int *decptp, int *signp));
382 # else
383 # if @HAVE_DECL_FCVT@
384 _GL_CXXALIAS_SYS (fcvt, char *,
385 (double number, int ndigits, int *decptp, int *signp));
386 # endif
387 # endif
388 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
389 _GL_CXXALIASWARN (fcvt);
390 # endif
391 #endif
393 #if @GNULIB_MDA_GCVT@
394 /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
395 required. In C++ with GNULIB_NAMESPACE, avoid differences between
396 platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
397 it. */
398 # if defined _WIN32 && !defined __CYGWIN__
399 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400 # undef gcvt
401 # define gcvt _gcvt
402 # endif
403 _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
404 # else
405 # if @HAVE_DECL_GCVT@
406 _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
407 # endif
408 # endif
409 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
410 _GL_CXXALIASWARN (gcvt);
411 # endif
412 #endif
414 #if @GNULIB_GETLOADAVG@
415 /* Store max(NELEM,3) load average numbers in LOADAVG[].
416 The three numbers are the load average of the last 1 minute, the last 5
417 minutes, and the last 15 minutes, respectively.
418 LOADAVG is an array of NELEM numbers. */
419 # if !@HAVE_DECL_GETLOADAVG@
420 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
421 _GL_ARG_NONNULL ((1)));
422 # endif
423 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
424 _GL_CXXALIASWARN (getloadavg);
425 #elif defined GNULIB_POSIXCHECK
426 # undef getloadavg
427 # if HAVE_RAW_DECL_GETLOADAVG
428 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
429 "use gnulib module getloadavg for portability");
430 # endif
431 #endif
433 #if @GNULIB_GETSUBOPT@
434 /* Assuming *OPTIONP is a comma separated list of elements of the form
435 "token" or "token=value", getsubopt parses the first of these elements.
436 If the first element refers to a "token" that is member of the given
437 NULL-terminated array of tokens:
438 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
439 the first option and the comma, sets *VALUEP to the value of the
440 element (or NULL if it doesn't contain an "=" sign),
441 - It returns the index of the "token" in the given array of tokens.
442 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
443 For more details see the POSIX specification.
444 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
445 # if !@HAVE_GETSUBOPT@
446 _GL_FUNCDECL_SYS (getsubopt, int,
447 (char **optionp, char *const *tokens, char **valuep)
448 _GL_ARG_NONNULL ((1, 2, 3)));
449 # endif
450 _GL_CXXALIAS_SYS (getsubopt, int,
451 (char **optionp, char *const *tokens, char **valuep));
452 _GL_CXXALIASWARN (getsubopt);
453 #elif defined GNULIB_POSIXCHECK
454 # undef getsubopt
455 # if HAVE_RAW_DECL_GETSUBOPT
456 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
457 "use gnulib module getsubopt for portability");
458 # endif
459 #endif
461 #if @GNULIB_GRANTPT@
462 /* Change the ownership and access permission of the slave side of the
463 pseudo-terminal whose master side is specified by FD. */
464 # if !@HAVE_GRANTPT@
465 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
466 # endif
467 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
468 _GL_CXXALIASWARN (grantpt);
469 #elif defined GNULIB_POSIXCHECK
470 # undef grantpt
471 # if HAVE_RAW_DECL_GRANTPT
472 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
473 "use gnulib module grantpt for portability");
474 # endif
475 #endif
477 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
478 rely on GNU or POSIX semantics for malloc and realloc (for example,
479 by never specifying a zero size), so it does not need malloc or
480 realloc to be redefined. */
481 #if @GNULIB_MALLOC_POSIX@
482 # if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
483 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
484 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
485 || _GL_USE_STDLIB_ALLOC)
486 # undef malloc
487 # define malloc rpl_malloc
488 # endif
489 _GL_FUNCDECL_RPL (malloc, void *,
490 (size_t size)
491 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
492 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
493 # else
494 # if __GNUC__ >= 11
495 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
496 _GL_FUNCDECL_SYS (malloc, void *,
497 (size_t size)
498 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
499 # endif
500 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
501 # endif
502 # if __GLIBC__ >= 2
503 _GL_CXXALIASWARN (malloc);
504 # endif
505 #else
506 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc
507 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
508 _GL_FUNCDECL_SYS (malloc, void *,
509 (size_t size)
510 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
511 # endif
512 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
513 # undef malloc
514 /* Assume malloc is always declared. */
515 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
516 "use gnulib module malloc-posix for portability");
517 # endif
518 #endif
520 /* Convert a multibyte character to a wide character. */
521 #if @GNULIB_MBTOWC@
522 # if @REPLACE_MBTOWC@
523 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
524 # undef mbtowc
525 # define mbtowc rpl_mbtowc
526 # endif
527 _GL_FUNCDECL_RPL (mbtowc, int,
528 (wchar_t *restrict pwc, const char *restrict s, size_t n));
529 _GL_CXXALIAS_RPL (mbtowc, int,
530 (wchar_t *restrict pwc, const char *restrict s, size_t n));
531 # else
532 # if !@HAVE_MBTOWC@
533 _GL_FUNCDECL_SYS (mbtowc, int,
534 (wchar_t *restrict pwc, const char *restrict s, size_t n));
535 # endif
536 _GL_CXXALIAS_SYS (mbtowc, int,
537 (wchar_t *restrict pwc, const char *restrict s, size_t n));
538 # endif
539 # if __GLIBC__ >= 2
540 _GL_CXXALIASWARN (mbtowc);
541 # endif
542 #elif defined GNULIB_POSIXCHECK
543 # undef mbtowc
544 # if HAVE_RAW_DECL_MBTOWC
545 _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
546 "use gnulib module mbtowc for portability");
547 # endif
548 #endif
550 #if @GNULIB_MKDTEMP@
551 /* Create a unique temporary directory from TEMPLATE.
552 The last six characters of TEMPLATE must be "XXXXXX";
553 they are replaced with a string that makes the directory name unique.
554 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
555 The directory is created mode 700. */
556 # if !@HAVE_MKDTEMP@
557 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
558 # endif
559 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
560 _GL_CXXALIASWARN (mkdtemp);
561 #elif defined GNULIB_POSIXCHECK
562 # undef mkdtemp
563 # if HAVE_RAW_DECL_MKDTEMP
564 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
565 "use gnulib module mkdtemp for portability");
566 # endif
567 #endif
569 #if @GNULIB_MKOSTEMP@
570 /* Create a unique temporary file from TEMPLATE.
571 The last six characters of TEMPLATE must be "XXXXXX";
572 they are replaced with a string that makes the file name unique.
573 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
574 and O_TEXT, O_BINARY (defined in "binary-io.h").
575 The file is then created, with the specified flags, ensuring it didn't exist
576 before.
577 The file is created read-write (mask at least 0600 & ~umask), but it may be
578 world-readable and world-writable (mask 0666 & ~umask), depending on the
579 implementation.
580 Returns the open file descriptor if successful, otherwise -1 and errno
581 set. */
582 # if !@HAVE_MKOSTEMP@
583 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
584 _GL_ARG_NONNULL ((1)));
585 # endif
586 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
587 _GL_CXXALIASWARN (mkostemp);
588 #elif defined GNULIB_POSIXCHECK
589 # undef mkostemp
590 # if HAVE_RAW_DECL_MKOSTEMP
591 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
592 "use gnulib module mkostemp for portability");
593 # endif
594 #endif
596 #if @GNULIB_MKOSTEMPS@
597 /* Create a unique temporary file from TEMPLATE.
598 The last six characters of TEMPLATE before a suffix of length
599 SUFFIXLEN must be "XXXXXX";
600 they are replaced with a string that makes the file name unique.
601 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
602 and O_TEXT, O_BINARY (defined in "binary-io.h").
603 The file is then created, with the specified flags, ensuring it didn't exist
604 before.
605 The file is created read-write (mask at least 0600 & ~umask), but it may be
606 world-readable and world-writable (mask 0666 & ~umask), depending on the
607 implementation.
608 Returns the open file descriptor if successful, otherwise -1 and errno
609 set. */
610 # if !@HAVE_MKOSTEMPS@
611 _GL_FUNCDECL_SYS (mkostemps, int,
612 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
613 _GL_ARG_NONNULL ((1)));
614 # endif
615 _GL_CXXALIAS_SYS (mkostemps, int,
616 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
617 _GL_CXXALIASWARN (mkostemps);
618 #elif defined GNULIB_POSIXCHECK
619 # undef mkostemps
620 # if HAVE_RAW_DECL_MKOSTEMPS
621 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
622 "use gnulib module mkostemps for portability");
623 # endif
624 #endif
626 #if @GNULIB_MKSTEMP@
627 /* Create a unique temporary file from TEMPLATE.
628 The last six characters of TEMPLATE must be "XXXXXX";
629 they are replaced with a string that makes the file name unique.
630 The file is then created, ensuring it didn't exist before.
631 The file is created read-write (mask at least 0600 & ~umask), but it may be
632 world-readable and world-writable (mask 0666 & ~umask), depending on the
633 implementation.
634 Returns the open file descriptor if successful, otherwise -1 and errno
635 set. */
636 # if @REPLACE_MKSTEMP@
637 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
638 # define mkstemp rpl_mkstemp
639 # endif
640 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
641 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
642 # else
643 # if ! @HAVE_MKSTEMP@
644 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
645 # endif
646 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
647 # endif
648 _GL_CXXALIASWARN (mkstemp);
649 #elif defined GNULIB_POSIXCHECK
650 # undef mkstemp
651 # if HAVE_RAW_DECL_MKSTEMP
652 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
653 "use gnulib module mkstemp for portability");
654 # endif
655 #endif
657 #if @GNULIB_MKSTEMPS@
658 /* Create a unique temporary file from TEMPLATE.
659 The last six characters of TEMPLATE prior to a suffix of length
660 SUFFIXLEN must be "XXXXXX";
661 they are replaced with a string that makes the file name unique.
662 The file is then created, ensuring it didn't exist before.
663 The file is created read-write (mask at least 0600 & ~umask), but it may be
664 world-readable and world-writable (mask 0666 & ~umask), depending on the
665 implementation.
666 Returns the open file descriptor if successful, otherwise -1 and errno
667 set. */
668 # if !@HAVE_MKSTEMPS@
669 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
670 _GL_ARG_NONNULL ((1)));
671 # endif
672 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
673 _GL_CXXALIASWARN (mkstemps);
674 #elif defined GNULIB_POSIXCHECK
675 # undef mkstemps
676 # if HAVE_RAW_DECL_MKSTEMPS
677 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
678 "use gnulib module mkstemps for portability");
679 # endif
680 #endif
682 #if @GNULIB_MDA_MKTEMP@
683 /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
684 required. In C++ with GNULIB_NAMESPACE, avoid differences between
685 platforms by defining GNULIB_NAMESPACE::mktemp always. */
686 # if defined _WIN32 && !defined __CYGWIN__
687 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
688 # undef mktemp
689 # define mktemp _mktemp
690 # endif
691 _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
692 # else
693 _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
694 # endif
695 _GL_CXXALIASWARN (mktemp);
696 #endif
698 /* Allocate memory with indefinite extent and specified alignment. */
699 #if @GNULIB_POSIX_MEMALIGN@
700 # if @REPLACE_POSIX_MEMALIGN@
701 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
702 # undef posix_memalign
703 # define posix_memalign rpl_posix_memalign
704 # endif
705 _GL_FUNCDECL_RPL (posix_memalign, int,
706 (void **memptr, size_t alignment, size_t size)
707 _GL_ARG_NONNULL ((1)));
708 _GL_CXXALIAS_RPL (posix_memalign, int,
709 (void **memptr, size_t alignment, size_t size));
710 # else
711 # if @HAVE_POSIX_MEMALIGN@
712 _GL_CXXALIAS_SYS (posix_memalign, int,
713 (void **memptr, size_t alignment, size_t size));
714 # endif
715 # endif
716 # if @HAVE_POSIX_MEMALIGN@
717 _GL_CXXALIASWARN (posix_memalign);
718 # endif
719 #elif defined GNULIB_POSIXCHECK
720 # undef posix_memalign
721 # if HAVE_RAW_DECL_POSIX_MEMALIGN
722 _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
723 "use gnulib module posix_memalign for portability");
724 # endif
725 #endif
727 #if @GNULIB_POSIX_OPENPT@
728 /* Return an FD open to the master side of a pseudo-terminal. Flags should
729 include O_RDWR, and may also include O_NOCTTY. */
730 # if !@HAVE_POSIX_OPENPT@
731 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
732 # endif
733 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
734 _GL_CXXALIASWARN (posix_openpt);
735 #elif defined GNULIB_POSIXCHECK
736 # undef posix_openpt
737 # if HAVE_RAW_DECL_POSIX_OPENPT
738 _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
739 "use gnulib module posix_openpt for portability");
740 # endif
741 #endif
743 #if @GNULIB_PTSNAME@
744 /* Return the pathname of the pseudo-terminal slave associated with
745 the master FD is open on, or NULL on errors. */
746 # if @REPLACE_PTSNAME@
747 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
748 # undef ptsname
749 # define ptsname rpl_ptsname
750 # endif
751 _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
752 _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
753 # else
754 # if !@HAVE_PTSNAME@
755 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
756 # endif
757 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
758 # endif
759 _GL_CXXALIASWARN (ptsname);
760 #elif defined GNULIB_POSIXCHECK
761 # undef ptsname
762 # if HAVE_RAW_DECL_PTSNAME
763 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
764 "use gnulib module ptsname for portability");
765 # endif
766 #endif
768 #if @GNULIB_PTSNAME_R@
769 /* Set the pathname of the pseudo-terminal slave associated with
770 the master FD is open on and return 0, or set errno and return
771 non-zero on errors. */
772 # if @REPLACE_PTSNAME_R@
773 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
774 # undef ptsname_r
775 # define ptsname_r rpl_ptsname_r
776 # endif
777 _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
778 _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
779 # else
780 # if !@HAVE_PTSNAME_R@
781 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
782 # endif
783 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
784 # endif
785 # ifndef GNULIB_defined_ptsname_r
786 # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
787 # endif
788 _GL_CXXALIASWARN (ptsname_r);
789 #elif defined GNULIB_POSIXCHECK
790 # undef ptsname_r
791 # if HAVE_RAW_DECL_PTSNAME_R
792 _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
793 "use gnulib module ptsname_r for portability");
794 # endif
795 #endif
797 #if @GNULIB_PUTENV@
798 # if @REPLACE_PUTENV@
799 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
800 # undef putenv
801 # define putenv rpl_putenv
802 # endif
803 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
804 _GL_CXXALIAS_RPL (putenv, int, (char *string));
805 # elif defined _WIN32 && !defined __CYGWIN__
806 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
807 # undef putenv
808 # define putenv _putenv
809 # endif
810 _GL_CXXALIAS_MDA (putenv, int, (char *string));
811 # else
812 _GL_CXXALIAS_SYS (putenv, int, (char *string));
813 # endif
814 _GL_CXXALIASWARN (putenv);
815 #elif @GNULIB_MDA_PUTENV@
816 /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
817 required. In C++ with GNULIB_NAMESPACE, avoid differences between
818 platforms by defining GNULIB_NAMESPACE::putenv always. */
819 # if defined _WIN32 && !defined __CYGWIN__
820 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
821 # undef putenv
822 # define putenv _putenv
823 # endif
824 /* Need to cast, because on mingw, the parameter is either
825 'const char *string' or 'char *string'. */
826 _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
827 # else
828 _GL_CXXALIAS_SYS (putenv, int, (char *string));
829 # endif
830 _GL_CXXALIASWARN (putenv);
831 #endif
833 #if @GNULIB_QSORT_R@
834 /* Sort an array of NMEMB elements, starting at address BASE, each element
835 occupying SIZE bytes, in ascending order according to the comparison
836 function COMPARE. */
837 # ifdef __cplusplus
838 extern "C" {
839 # endif
840 # if !GNULIB_defined_qsort_r_fn_types
841 typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
842 # define GNULIB_defined_qsort_r_fn_types 1
843 # endif
844 # ifdef __cplusplus
846 # endif
847 # if @REPLACE_QSORT_R@
848 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
849 # undef qsort_r
850 # define qsort_r rpl_qsort_r
851 # endif
852 _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
853 _gl_qsort_r_compar_fn compare,
854 void *arg) _GL_ARG_NONNULL ((1, 4)));
855 _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
856 _gl_qsort_r_compar_fn compare,
857 void *arg));
858 # else
859 # if !@HAVE_QSORT_R@
860 _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
861 _gl_qsort_r_compar_fn compare,
862 void *arg) _GL_ARG_NONNULL ((1, 4)));
863 # endif
864 _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
865 _gl_qsort_r_compar_fn compare,
866 void *arg));
867 # endif
868 _GL_CXXALIASWARN (qsort_r);
869 #elif defined GNULIB_POSIXCHECK
870 # undef qsort_r
871 # if HAVE_RAW_DECL_QSORT_R
872 _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
873 "use gnulib module qsort_r for portability");
874 # endif
875 #endif
878 #if @GNULIB_RANDOM_R@
879 # if !@HAVE_RANDOM_R@
880 # ifndef RAND_MAX
881 # define RAND_MAX 2147483647
882 # endif
883 # endif
884 #endif
887 #if @GNULIB_RANDOM@
888 # if @REPLACE_RANDOM@
889 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
890 # undef random
891 # define random rpl_random
892 # endif
893 _GL_FUNCDECL_RPL (random, long, (void));
894 _GL_CXXALIAS_RPL (random, long, (void));
895 # else
896 # if !@HAVE_RANDOM@
897 _GL_FUNCDECL_SYS (random, long, (void));
898 # endif
899 /* Need to cast, because on Haiku, the return type is
900 int. */
901 _GL_CXXALIAS_SYS_CAST (random, long, (void));
902 # endif
903 _GL_CXXALIASWARN (random);
904 #elif defined GNULIB_POSIXCHECK
905 # undef random
906 # if HAVE_RAW_DECL_RANDOM
907 _GL_WARN_ON_USE (random, "random is unportable - "
908 "use gnulib module random for portability");
909 # endif
910 #endif
912 #if @GNULIB_RANDOM@
913 # if @REPLACE_RANDOM@
914 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
915 # undef srandom
916 # define srandom rpl_srandom
917 # endif
918 _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
919 _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
920 # else
921 # if !@HAVE_RANDOM@
922 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
923 # endif
924 /* Need to cast, because on FreeBSD, the first parameter is
925 unsigned long seed. */
926 _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
927 # endif
928 _GL_CXXALIASWARN (srandom);
929 #elif defined GNULIB_POSIXCHECK
930 # undef srandom
931 # if HAVE_RAW_DECL_SRANDOM
932 _GL_WARN_ON_USE (srandom, "srandom is unportable - "
933 "use gnulib module random for portability");
934 # endif
935 #endif
937 #if @GNULIB_RANDOM@
938 # if @REPLACE_INITSTATE@
939 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
940 # undef initstate
941 # define initstate rpl_initstate
942 # endif
943 _GL_FUNCDECL_RPL (initstate, char *,
944 (unsigned int seed, char *buf, size_t buf_size)
945 _GL_ARG_NONNULL ((2)));
946 _GL_CXXALIAS_RPL (initstate, char *,
947 (unsigned int seed, char *buf, size_t buf_size));
948 # else
949 # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
950 _GL_FUNCDECL_SYS (initstate, char *,
951 (unsigned int seed, char *buf, size_t buf_size)
952 _GL_ARG_NONNULL ((2)));
953 # endif
954 /* Need to cast, because on FreeBSD, the first parameter is
955 unsigned long seed. */
956 _GL_CXXALIAS_SYS_CAST (initstate, char *,
957 (unsigned int seed, char *buf, size_t buf_size));
958 # endif
959 _GL_CXXALIASWARN (initstate);
960 #elif defined GNULIB_POSIXCHECK
961 # undef initstate
962 # if HAVE_RAW_DECL_INITSTATE
963 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
964 "use gnulib module random for portability");
965 # endif
966 #endif
968 #if @GNULIB_RANDOM@
969 # if @REPLACE_SETSTATE@
970 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
971 # undef setstate
972 # define setstate rpl_setstate
973 # endif
974 _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
975 _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
976 # else
977 # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
978 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
979 # endif
980 /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
981 is const char *arg_state. */
982 _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
983 # endif
984 _GL_CXXALIASWARN (setstate);
985 #elif defined GNULIB_POSIXCHECK
986 # undef setstate
987 # if HAVE_RAW_DECL_SETSTATE
988 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
989 "use gnulib module random for portability");
990 # endif
991 #endif
994 #if @GNULIB_RANDOM_R@
995 # if @REPLACE_RANDOM_R@
996 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
997 # undef random_r
998 # define random_r rpl_random_r
999 # endif
1000 _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
1001 _GL_ARG_NONNULL ((1, 2)));
1002 _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1003 # else
1004 # if !@HAVE_RANDOM_R@
1005 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
1006 _GL_ARG_NONNULL ((1, 2)));
1007 # endif
1008 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
1009 # endif
1010 _GL_CXXALIASWARN (random_r);
1011 #elif defined GNULIB_POSIXCHECK
1012 # undef random_r
1013 # if HAVE_RAW_DECL_RANDOM_R
1014 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1015 "use gnulib module random_r for portability");
1016 # endif
1017 #endif
1019 #if @GNULIB_RANDOM_R@
1020 # if @REPLACE_RANDOM_R@
1021 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1022 # undef srandom_r
1023 # define srandom_r rpl_srandom_r
1024 # endif
1025 _GL_FUNCDECL_RPL (srandom_r, int,
1026 (unsigned int seed, struct random_data *rand_state)
1027 _GL_ARG_NONNULL ((2)));
1028 _GL_CXXALIAS_RPL (srandom_r, int,
1029 (unsigned int seed, struct random_data *rand_state));
1030 # else
1031 # if !@HAVE_RANDOM_R@
1032 _GL_FUNCDECL_SYS (srandom_r, int,
1033 (unsigned int seed, struct random_data *rand_state)
1034 _GL_ARG_NONNULL ((2)));
1035 # endif
1036 _GL_CXXALIAS_SYS (srandom_r, int,
1037 (unsigned int seed, struct random_data *rand_state));
1038 # endif
1039 _GL_CXXALIASWARN (srandom_r);
1040 #elif defined GNULIB_POSIXCHECK
1041 # undef srandom_r
1042 # if HAVE_RAW_DECL_SRANDOM_R
1043 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1044 "use gnulib module random_r for portability");
1045 # endif
1046 #endif
1048 #if @GNULIB_RANDOM_R@
1049 # if @REPLACE_RANDOM_R@
1050 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1051 # undef initstate_r
1052 # define initstate_r rpl_initstate_r
1053 # endif
1054 _GL_FUNCDECL_RPL (initstate_r, int,
1055 (unsigned int seed, char *buf, size_t buf_size,
1056 struct random_data *rand_state)
1057 _GL_ARG_NONNULL ((2, 4)));
1058 _GL_CXXALIAS_RPL (initstate_r, int,
1059 (unsigned int seed, char *buf, size_t buf_size,
1060 struct random_data *rand_state));
1061 # else
1062 # if !@HAVE_RANDOM_R@
1063 _GL_FUNCDECL_SYS (initstate_r, int,
1064 (unsigned int seed, char *buf, size_t buf_size,
1065 struct random_data *rand_state)
1066 _GL_ARG_NONNULL ((2, 4)));
1067 # endif
1068 /* Need to cast, because on Haiku, the third parameter is
1069 unsigned long buf_size. */
1070 _GL_CXXALIAS_SYS_CAST (initstate_r, int,
1071 (unsigned int seed, char *buf, size_t buf_size,
1072 struct random_data *rand_state));
1073 # endif
1074 _GL_CXXALIASWARN (initstate_r);
1075 #elif defined GNULIB_POSIXCHECK
1076 # undef initstate_r
1077 # if HAVE_RAW_DECL_INITSTATE_R
1078 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1079 "use gnulib module random_r for portability");
1080 # endif
1081 #endif
1083 #if @GNULIB_RANDOM_R@
1084 # if @REPLACE_RANDOM_R@
1085 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1086 # undef setstate_r
1087 # define setstate_r rpl_setstate_r
1088 # endif
1089 _GL_FUNCDECL_RPL (setstate_r, int,
1090 (char *arg_state, struct random_data *rand_state)
1091 _GL_ARG_NONNULL ((1, 2)));
1092 _GL_CXXALIAS_RPL (setstate_r, int,
1093 (char *arg_state, struct random_data *rand_state));
1094 # else
1095 # if !@HAVE_RANDOM_R@
1096 _GL_FUNCDECL_SYS (setstate_r, int,
1097 (char *arg_state, struct random_data *rand_state)
1098 _GL_ARG_NONNULL ((1, 2)));
1099 # endif
1100 /* Need to cast, because on Haiku, the first parameter is
1101 void *arg_state. */
1102 _GL_CXXALIAS_SYS_CAST (setstate_r, int,
1103 (char *arg_state, struct random_data *rand_state));
1104 # endif
1105 _GL_CXXALIASWARN (setstate_r);
1106 #elif defined GNULIB_POSIXCHECK
1107 # undef setstate_r
1108 # if HAVE_RAW_DECL_SETSTATE_R
1109 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1110 "use gnulib module random_r for portability");
1111 # endif
1112 #endif
1115 #if @GNULIB_REALLOC_POSIX@
1116 # if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
1117 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
1118 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1119 || _GL_USE_STDLIB_ALLOC)
1120 # undef realloc
1121 # define realloc rpl_realloc
1122 # endif
1123 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
1124 _GL_ATTRIBUTE_DEALLOC_FREE);
1125 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1126 # else
1127 # if __GNUC__ >= 11
1128 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1129 _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
1130 _GL_ATTRIBUTE_DEALLOC_FREE);
1131 # endif
1132 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1133 # endif
1134 # if __GLIBC__ >= 2
1135 _GL_CXXALIASWARN (realloc);
1136 # endif
1137 #else
1138 # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
1139 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1140 _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
1141 _GL_ATTRIBUTE_DEALLOC_FREE);
1142 # endif
1143 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1144 # undef realloc
1145 /* Assume realloc is always declared. */
1146 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1147 "use gnulib module realloc-posix for portability");
1148 # endif
1149 #endif
1152 #if @GNULIB_REALLOCARRAY@
1153 # if @REPLACE_REALLOCARRAY@
1154 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1155 # undef reallocarray
1156 # define reallocarray rpl_reallocarray
1157 # endif
1158 _GL_FUNCDECL_RPL (reallocarray, void *,
1159 (void *ptr, size_t nmemb, size_t size));
1160 _GL_CXXALIAS_RPL (reallocarray, void *,
1161 (void *ptr, size_t nmemb, size_t size));
1162 # else
1163 # if ! @HAVE_REALLOCARRAY@
1164 _GL_FUNCDECL_SYS (reallocarray, void *,
1165 (void *ptr, size_t nmemb, size_t size));
1166 # endif
1167 _GL_CXXALIAS_SYS (reallocarray, void *,
1168 (void *ptr, size_t nmemb, size_t size));
1169 # endif
1170 _GL_CXXALIASWARN (reallocarray);
1171 #elif defined GNULIB_POSIXCHECK
1172 # undef reallocarray
1173 # if HAVE_RAW_DECL_REALLOCARRAY
1174 _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1175 "use gnulib module reallocarray for portability");
1176 # endif
1177 #endif
1179 #if @GNULIB_REALPATH@
1180 # if @REPLACE_REALPATH@
1181 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1182 # define realpath rpl_realpath
1183 # endif
1184 _GL_FUNCDECL_RPL (realpath, char *,
1185 (const char *restrict name, char *restrict resolved)
1186 _GL_ARG_NONNULL ((1)));
1187 _GL_CXXALIAS_RPL (realpath, char *,
1188 (const char *restrict name, char *restrict resolved));
1189 # else
1190 # if !@HAVE_REALPATH@
1191 _GL_FUNCDECL_SYS (realpath, char *,
1192 (const char *restrict name, char *restrict resolved)
1193 _GL_ARG_NONNULL ((1)));
1194 # endif
1195 _GL_CXXALIAS_SYS (realpath, char *,
1196 (const char *restrict name, char *restrict resolved));
1197 # endif
1198 _GL_CXXALIASWARN (realpath);
1199 #elif defined GNULIB_POSIXCHECK
1200 # undef realpath
1201 # if HAVE_RAW_DECL_REALPATH
1202 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1203 "canonicalize or canonicalize-lgpl for portability");
1204 # endif
1205 #endif
1207 #if @GNULIB_RPMATCH@
1208 /* Test a user response to a question.
1209 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1210 # if !@HAVE_RPMATCH@
1211 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
1212 # endif
1213 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1214 _GL_CXXALIASWARN (rpmatch);
1215 #elif defined GNULIB_POSIXCHECK
1216 # undef rpmatch
1217 # if HAVE_RAW_DECL_RPMATCH
1218 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1219 "use gnulib module rpmatch for portability");
1220 # endif
1221 #endif
1223 #if @GNULIB_SECURE_GETENV@
1224 /* Look up NAME in the environment, returning 0 in insecure situations. */
1225 # if !@HAVE_SECURE_GETENV@
1226 _GL_FUNCDECL_SYS (secure_getenv, char *,
1227 (char const *name) _GL_ARG_NONNULL ((1)));
1228 # endif
1229 _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1230 _GL_CXXALIASWARN (secure_getenv);
1231 #elif defined GNULIB_POSIXCHECK
1232 # undef secure_getenv
1233 # if HAVE_RAW_DECL_SECURE_GETENV
1234 _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1235 "use gnulib module secure_getenv for portability");
1236 # endif
1237 #endif
1239 #if @GNULIB_SETENV@
1240 /* Set NAME to VALUE in the environment.
1241 If REPLACE is nonzero, overwrite an existing value. */
1242 # if @REPLACE_SETENV@
1243 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1244 # undef setenv
1245 # define setenv rpl_setenv
1246 # endif
1247 _GL_FUNCDECL_RPL (setenv, int,
1248 (const char *name, const char *value, int replace)
1249 _GL_ARG_NONNULL ((1)));
1250 _GL_CXXALIAS_RPL (setenv, int,
1251 (const char *name, const char *value, int replace));
1252 # else
1253 # if !@HAVE_DECL_SETENV@
1254 _GL_FUNCDECL_SYS (setenv, int,
1255 (const char *name, const char *value, int replace)
1256 _GL_ARG_NONNULL ((1)));
1257 # endif
1258 _GL_CXXALIAS_SYS (setenv, int,
1259 (const char *name, const char *value, int replace));
1260 # endif
1261 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
1262 _GL_CXXALIASWARN (setenv);
1263 # endif
1264 #elif defined GNULIB_POSIXCHECK
1265 # undef setenv
1266 # if HAVE_RAW_DECL_SETENV
1267 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1268 "use gnulib module setenv for portability");
1269 # endif
1270 #endif
1272 #if @GNULIB_STRTOD@
1273 /* Parse a double from STRING, updating ENDP if appropriate. */
1274 # if @REPLACE_STRTOD@
1275 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1276 # define strtod rpl_strtod
1277 # endif
1278 # define GNULIB_defined_strtod_function 1
1279 _GL_FUNCDECL_RPL (strtod, double,
1280 (const char *restrict str, char **restrict endp)
1281 _GL_ARG_NONNULL ((1)));
1282 _GL_CXXALIAS_RPL (strtod, double,
1283 (const char *restrict str, char **restrict endp));
1284 # else
1285 # if !@HAVE_STRTOD@
1286 _GL_FUNCDECL_SYS (strtod, double,
1287 (const char *restrict str, char **restrict endp)
1288 _GL_ARG_NONNULL ((1)));
1289 # endif
1290 _GL_CXXALIAS_SYS (strtod, double,
1291 (const char *restrict str, char **restrict endp));
1292 # endif
1293 # if __GLIBC__ >= 2
1294 _GL_CXXALIASWARN (strtod);
1295 # endif
1296 #elif defined GNULIB_POSIXCHECK
1297 # undef strtod
1298 # if HAVE_RAW_DECL_STRTOD
1299 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1300 "use gnulib module strtod for portability");
1301 # endif
1302 #endif
1304 #if @GNULIB_STRTOLD@
1305 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
1306 # if @REPLACE_STRTOLD@
1307 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1308 # define strtold rpl_strtold
1309 # endif
1310 # define GNULIB_defined_strtold_function 1
1311 _GL_FUNCDECL_RPL (strtold, long double,
1312 (const char *restrict str, char **restrict endp)
1313 _GL_ARG_NONNULL ((1)));
1314 _GL_CXXALIAS_RPL (strtold, long double,
1315 (const char *restrict str, char **restrict endp));
1316 # else
1317 # if !@HAVE_STRTOLD@
1318 _GL_FUNCDECL_SYS (strtold, long double,
1319 (const char *restrict str, char **restrict endp)
1320 _GL_ARG_NONNULL ((1)));
1321 # endif
1322 _GL_CXXALIAS_SYS (strtold, long double,
1323 (const char *restrict str, char **restrict endp));
1324 # endif
1325 _GL_CXXALIASWARN (strtold);
1326 #elif defined GNULIB_POSIXCHECK
1327 # undef strtold
1328 # if HAVE_RAW_DECL_STRTOLD
1329 _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1330 "use gnulib module strtold for portability");
1331 # endif
1332 #endif
1334 #if @GNULIB_STRTOL@
1335 /* Parse a signed integer whose textual representation starts at STRING.
1336 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1337 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1338 "0x").
1339 If ENDPTR is not NULL, the address of the first byte after the integer is
1340 stored in *ENDPTR.
1341 Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
1342 to ERANGE. */
1343 # if @REPLACE_STRTOL@
1344 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1345 # define strtol rpl_strtol
1346 # endif
1347 # define GNULIB_defined_strtol_function 1
1348 _GL_FUNCDECL_RPL (strtol, long,
1349 (const char *restrict string, char **restrict endptr,
1350 int base)
1351 _GL_ARG_NONNULL ((1)));
1352 _GL_CXXALIAS_RPL (strtol, long,
1353 (const char *restrict string, char **restrict endptr,
1354 int base));
1355 # else
1356 # if !@HAVE_STRTOL@
1357 _GL_FUNCDECL_SYS (strtol, long,
1358 (const char *restrict string, char **restrict endptr,
1359 int base)
1360 _GL_ARG_NONNULL ((1)));
1361 # endif
1362 _GL_CXXALIAS_SYS (strtol, long,
1363 (const char *restrict string, char **restrict endptr,
1364 int base));
1365 # endif
1366 # if __GLIBC__ >= 2
1367 _GL_CXXALIASWARN (strtol);
1368 # endif
1369 #elif defined GNULIB_POSIXCHECK
1370 # undef strtol
1371 # if HAVE_RAW_DECL_STRTOL
1372 _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1373 "use gnulib module strtol for portability");
1374 # endif
1375 #endif
1377 #if @GNULIB_STRTOLL@
1378 /* Parse a signed integer whose textual representation starts at STRING.
1379 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1380 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1381 "0x").
1382 If ENDPTR is not NULL, the address of the first byte after the integer is
1383 stored in *ENDPTR.
1384 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
1385 to ERANGE. */
1386 # if @REPLACE_STRTOLL@
1387 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1388 # define strtoll rpl_strtoll
1389 # endif
1390 # define GNULIB_defined_strtoll_function 1
1391 _GL_FUNCDECL_RPL (strtoll, long long,
1392 (const char *restrict string, char **restrict endptr,
1393 int base)
1394 _GL_ARG_NONNULL ((1)));
1395 _GL_CXXALIAS_RPL (strtoll, long long,
1396 (const char *restrict string, char **restrict endptr,
1397 int base));
1398 # else
1399 # if !@HAVE_STRTOLL@
1400 _GL_FUNCDECL_SYS (strtoll, long long,
1401 (const char *restrict string, char **restrict endptr,
1402 int base)
1403 _GL_ARG_NONNULL ((1)));
1404 # endif
1405 _GL_CXXALIAS_SYS (strtoll, long long,
1406 (const char *restrict string, char **restrict endptr,
1407 int base));
1408 # endif
1409 _GL_CXXALIASWARN (strtoll);
1410 #elif defined GNULIB_POSIXCHECK
1411 # undef strtoll
1412 # if HAVE_RAW_DECL_STRTOLL
1413 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1414 "use gnulib module strtoll for portability");
1415 # endif
1416 #endif
1418 #if @GNULIB_STRTOUL@
1419 /* Parse an unsigned integer whose textual representation starts at STRING.
1420 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1421 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1422 "0x").
1423 If ENDPTR is not NULL, the address of the first byte after the integer is
1424 stored in *ENDPTR.
1425 Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */
1426 # if @REPLACE_STRTOUL@
1427 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1428 # define strtoul rpl_strtoul
1429 # endif
1430 # define GNULIB_defined_strtoul_function 1
1431 _GL_FUNCDECL_RPL (strtoul, unsigned long,
1432 (const char *restrict string, char **restrict endptr,
1433 int base)
1434 _GL_ARG_NONNULL ((1)));
1435 _GL_CXXALIAS_RPL (strtoul, unsigned long,
1436 (const char *restrict string, char **restrict endptr,
1437 int base));
1438 # else
1439 # if !@HAVE_STRTOUL@
1440 _GL_FUNCDECL_SYS (strtoul, unsigned long,
1441 (const char *restrict string, char **restrict endptr,
1442 int base)
1443 _GL_ARG_NONNULL ((1)));
1444 # endif
1445 _GL_CXXALIAS_SYS (strtoul, unsigned long,
1446 (const char *restrict string, char **restrict endptr,
1447 int base));
1448 # endif
1449 # if __GLIBC__ >= 2
1450 _GL_CXXALIASWARN (strtoul);
1451 # endif
1452 #elif defined GNULIB_POSIXCHECK
1453 # undef strtoul
1454 # if HAVE_RAW_DECL_STRTOUL
1455 _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1456 "use gnulib module strtoul for portability");
1457 # endif
1458 #endif
1460 #if @GNULIB_STRTOULL@
1461 /* Parse an unsigned integer whose textual representation starts at STRING.
1462 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1463 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1464 "0x").
1465 If ENDPTR is not NULL, the address of the first byte after the integer is
1466 stored in *ENDPTR.
1467 Upon overflow, the return value is ULLONG_MAX, and errno is set to
1468 ERANGE. */
1469 # if @REPLACE_STRTOULL@
1470 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1471 # define strtoull rpl_strtoull
1472 # endif
1473 # define GNULIB_defined_strtoull_function 1
1474 _GL_FUNCDECL_RPL (strtoull, unsigned long long,
1475 (const char *restrict string, char **restrict endptr,
1476 int base)
1477 _GL_ARG_NONNULL ((1)));
1478 _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1479 (const char *restrict string, char **restrict endptr,
1480 int base));
1481 # else
1482 # if !@HAVE_STRTOULL@
1483 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
1484 (const char *restrict string, char **restrict endptr,
1485 int base)
1486 _GL_ARG_NONNULL ((1)));
1487 # endif
1488 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
1489 (const char *restrict string, char **restrict endptr,
1490 int base));
1491 # endif
1492 _GL_CXXALIASWARN (strtoull);
1493 #elif defined GNULIB_POSIXCHECK
1494 # undef strtoull
1495 # if HAVE_RAW_DECL_STRTOULL
1496 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1497 "use gnulib module strtoull for portability");
1498 # endif
1499 #endif
1501 #if @GNULIB_UNLOCKPT@
1502 /* Unlock the slave side of the pseudo-terminal whose master side is specified
1503 by FD, so that it can be opened. */
1504 # if !@HAVE_UNLOCKPT@
1505 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
1506 # endif
1507 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1508 _GL_CXXALIASWARN (unlockpt);
1509 #elif defined GNULIB_POSIXCHECK
1510 # undef unlockpt
1511 # if HAVE_RAW_DECL_UNLOCKPT
1512 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1513 "use gnulib module unlockpt for portability");
1514 # endif
1515 #endif
1517 #if @GNULIB_UNSETENV@
1518 /* Remove the variable NAME from the environment. */
1519 # if @REPLACE_UNSETENV@
1520 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1521 # undef unsetenv
1522 # define unsetenv rpl_unsetenv
1523 # endif
1524 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1525 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1526 # else
1527 # if !@HAVE_DECL_UNSETENV@
1528 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1529 # endif
1530 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1531 # endif
1532 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
1533 _GL_CXXALIASWARN (unsetenv);
1534 # endif
1535 #elif defined GNULIB_POSIXCHECK
1536 # undef unsetenv
1537 # if HAVE_RAW_DECL_UNSETENV
1538 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1539 "use gnulib module unsetenv for portability");
1540 # endif
1541 #endif
1543 /* Convert a wide character to a multibyte character. */
1544 #if @GNULIB_WCTOMB@
1545 # if @REPLACE_WCTOMB@
1546 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1547 # undef wctomb
1548 # define wctomb rpl_wctomb
1549 # endif
1550 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
1551 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1552 # else
1553 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
1554 # endif
1555 # if __GLIBC__ >= 2
1556 _GL_CXXALIASWARN (wctomb);
1557 # endif
1558 #endif
1561 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1562 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1563 #endif