* configure.ac: Fix minimum Jansson version requirement.
[emacs.git] / lib / stdlib.in.h
blobd5fa02b57aba0e0df86adf0f3fcb1abb8e664064
1 /* A GNU-like <stdlib.h>.
3 Copyright (C) 1995, 2001-2004, 2006-2017 Free Software Foundation, Inc.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program 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 General Public License for more details.
15 You should have received a copy of the GNU 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 # include <sys/loadavg.h>
51 #endif
53 /* Native Windows platforms declare mktemp() in <io.h>. */
54 #if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
55 # include <io.h>
56 #endif
58 #if @GNULIB_RANDOM_R@
60 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
61 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
62 'struct random_data'. */
63 # if @HAVE_RANDOM_H@
64 # include <random.h>
65 # endif
67 # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
68 # include <stdint.h>
69 # endif
71 # if !@HAVE_STRUCT_RANDOM_DATA@
72 /* Define 'struct random_data'.
73 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
74 # if !GNULIB_defined_struct_random_data
75 struct random_data
77 int32_t *fptr; /* Front pointer. */
78 int32_t *rptr; /* Rear pointer. */
79 int32_t *state; /* Array of state values. */
80 int rand_type; /* Type of random number generator. */
81 int rand_deg; /* Degree of random number generator. */
82 int rand_sep; /* Distance between front and rear. */
83 int32_t *end_ptr; /* Pointer behind state table. */
85 # define GNULIB_defined_struct_random_data 1
86 # endif
87 # endif
88 #endif
90 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
91 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
92 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
93 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
94 /* But avoid namespace pollution on glibc systems and native Windows. */
95 # include <unistd.h>
96 #endif
98 /* The __attribute__ feature is available in gcc versions 2.5 and later.
99 The attribute __pure__ was added in gcc 2.96. */
100 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
101 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
102 #else
103 # define _GL_ATTRIBUTE_PURE /* empty */
104 #endif
106 /* The definition of _Noreturn is copied here. */
108 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
110 /* The definition of _GL_ARG_NONNULL is copied here. */
112 /* The definition of _GL_WARN_ON_USE is copied here. */
115 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
116 #ifndef EXIT_SUCCESS
117 # define EXIT_SUCCESS 0
118 #endif
119 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
120 with proper operation of xargs. */
121 #ifndef EXIT_FAILURE
122 # define EXIT_FAILURE 1
123 #elif EXIT_FAILURE != 1
124 # undef EXIT_FAILURE
125 # define EXIT_FAILURE 1
126 #endif
129 #if @GNULIB__EXIT@
130 /* Terminate the current process with the given return code, without running
131 the 'atexit' handlers. */
132 # if !@HAVE__EXIT@
133 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
134 # endif
135 _GL_CXXALIAS_SYS (_Exit, void, (int status));
136 _GL_CXXALIASWARN (_Exit);
137 #elif defined GNULIB_POSIXCHECK
138 # undef _Exit
139 # if HAVE_RAW_DECL__EXIT
140 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
141 "use gnulib module _Exit for portability");
142 # endif
143 #endif
146 #if @GNULIB_ATOLL@
147 /* Parse a signed decimal integer.
148 Returns the value of the integer. Errors are not detected. */
149 # if !@HAVE_ATOLL@
150 _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
151 _GL_ATTRIBUTE_PURE
152 _GL_ARG_NONNULL ((1)));
153 # endif
154 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
155 _GL_CXXALIASWARN (atoll);
156 #elif defined GNULIB_POSIXCHECK
157 # undef atoll
158 # if HAVE_RAW_DECL_ATOLL
159 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
160 "use gnulib module atoll for portability");
161 # endif
162 #endif
164 #if @GNULIB_CALLOC_POSIX@
165 # if @REPLACE_CALLOC@
166 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
167 # undef calloc
168 # define calloc rpl_calloc
169 # endif
170 _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
171 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
172 # else
173 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
174 # endif
175 _GL_CXXALIASWARN (calloc);
176 #elif defined GNULIB_POSIXCHECK
177 # undef calloc
178 /* Assume calloc is always declared. */
179 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
180 "use gnulib module calloc-posix for portability");
181 #endif
183 #if @GNULIB_CANONICALIZE_FILE_NAME@
184 # if @REPLACE_CANONICALIZE_FILE_NAME@
185 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
186 # define canonicalize_file_name rpl_canonicalize_file_name
187 # endif
188 _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
189 _GL_ARG_NONNULL ((1)));
190 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
191 # else
192 # if !@HAVE_CANONICALIZE_FILE_NAME@
193 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
194 _GL_ARG_NONNULL ((1)));
195 # endif
196 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
197 # endif
198 _GL_CXXALIASWARN (canonicalize_file_name);
199 #elif defined GNULIB_POSIXCHECK
200 # undef canonicalize_file_name
201 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
202 _GL_WARN_ON_USE (canonicalize_file_name,
203 "canonicalize_file_name is unportable - "
204 "use gnulib module canonicalize-lgpl for portability");
205 # endif
206 #endif
208 #if @GNULIB_GETLOADAVG@
209 /* Store max(NELEM,3) load average numbers in LOADAVG[].
210 The three numbers are the load average of the last 1 minute, the last 5
211 minutes, and the last 15 minutes, respectively.
212 LOADAVG is an array of NELEM numbers. */
213 # if !@HAVE_DECL_GETLOADAVG@
214 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
215 _GL_ARG_NONNULL ((1)));
216 # endif
217 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
218 _GL_CXXALIASWARN (getloadavg);
219 #elif defined GNULIB_POSIXCHECK
220 # undef getloadavg
221 # if HAVE_RAW_DECL_GETLOADAVG
222 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
223 "use gnulib module getloadavg for portability");
224 # endif
225 #endif
227 #if @GNULIB_GETSUBOPT@
228 /* Assuming *OPTIONP is a comma separated list of elements of the form
229 "token" or "token=value", getsubopt parses the first of these elements.
230 If the first element refers to a "token" that is member of the given
231 NULL-terminated array of tokens:
232 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
233 the first option and the comma, sets *VALUEP to the value of the
234 element (or NULL if it doesn't contain an "=" sign),
235 - It returns the index of the "token" in the given array of tokens.
236 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
237 For more details see the POSIX:2001 specification.
238 http://www.opengroup.org/susv3xsh/getsubopt.html */
239 # if !@HAVE_GETSUBOPT@
240 _GL_FUNCDECL_SYS (getsubopt, int,
241 (char **optionp, char *const *tokens, char **valuep)
242 _GL_ARG_NONNULL ((1, 2, 3)));
243 # endif
244 _GL_CXXALIAS_SYS (getsubopt, int,
245 (char **optionp, char *const *tokens, char **valuep));
246 _GL_CXXALIASWARN (getsubopt);
247 #elif defined GNULIB_POSIXCHECK
248 # undef getsubopt
249 # if HAVE_RAW_DECL_GETSUBOPT
250 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
251 "use gnulib module getsubopt for portability");
252 # endif
253 #endif
255 #if @GNULIB_GRANTPT@
256 /* Change the ownership and access permission of the slave side of the
257 pseudo-terminal whose master side is specified by FD. */
258 # if !@HAVE_GRANTPT@
259 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
260 # endif
261 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
262 _GL_CXXALIASWARN (grantpt);
263 #elif defined GNULIB_POSIXCHECK
264 # undef grantpt
265 # if HAVE_RAW_DECL_GRANTPT
266 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
267 "use gnulib module grantpt for portability");
268 # endif
269 #endif
271 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
272 rely on GNU or POSIX semantics for malloc and realloc (for example,
273 by never specifying a zero size), so it does not need malloc or
274 realloc to be redefined. */
275 #if @GNULIB_MALLOC_POSIX@
276 # if @REPLACE_MALLOC@
277 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
278 || _GL_USE_STDLIB_ALLOC)
279 # undef malloc
280 # define malloc rpl_malloc
281 # endif
282 _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
283 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
284 # else
285 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
286 # endif
287 _GL_CXXALIASWARN (malloc);
288 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
289 # undef malloc
290 /* Assume malloc is always declared. */
291 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
292 "use gnulib module malloc-posix for portability");
293 #endif
295 /* Convert a multibyte character to a wide character. */
296 #if @GNULIB_MBTOWC@
297 # if @REPLACE_MBTOWC@
298 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
299 # undef mbtowc
300 # define mbtowc rpl_mbtowc
301 # endif
302 _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
303 _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
304 # else
305 _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
306 # endif
307 _GL_CXXALIASWARN (mbtowc);
308 #endif
310 #if @GNULIB_MKDTEMP@
311 /* Create a unique temporary directory from TEMPLATE.
312 The last six characters of TEMPLATE must be "XXXXXX";
313 they are replaced with a string that makes the directory name unique.
314 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
315 The directory is created mode 700. */
316 # if !@HAVE_MKDTEMP@
317 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
318 # endif
319 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
320 _GL_CXXALIASWARN (mkdtemp);
321 #elif defined GNULIB_POSIXCHECK
322 # undef mkdtemp
323 # if HAVE_RAW_DECL_MKDTEMP
324 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
325 "use gnulib module mkdtemp for portability");
326 # endif
327 #endif
329 #if @GNULIB_MKOSTEMP@
330 /* Create a unique temporary file from TEMPLATE.
331 The last six characters of TEMPLATE must be "XXXXXX";
332 they are replaced with a string that makes the file name unique.
333 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
334 and O_TEXT, O_BINARY (defined in "binary-io.h").
335 The file is then created, with the specified flags, ensuring it didn't exist
336 before.
337 The file is created read-write (mask at least 0600 & ~umask), but it may be
338 world-readable and world-writable (mask 0666 & ~umask), depending on the
339 implementation.
340 Returns the open file descriptor if successful, otherwise -1 and errno
341 set. */
342 # if !@HAVE_MKOSTEMP@
343 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
344 _GL_ARG_NONNULL ((1)));
345 # endif
346 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
347 _GL_CXXALIASWARN (mkostemp);
348 #elif defined GNULIB_POSIXCHECK
349 # undef mkostemp
350 # if HAVE_RAW_DECL_MKOSTEMP
351 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
352 "use gnulib module mkostemp for portability");
353 # endif
354 #endif
356 #if @GNULIB_MKOSTEMPS@
357 /* Create a unique temporary file from TEMPLATE.
358 The last six characters of TEMPLATE before a suffix of length
359 SUFFIXLEN must be "XXXXXX";
360 they are replaced with a string that makes the file name unique.
361 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
362 and O_TEXT, O_BINARY (defined in "binary-io.h").
363 The file is then created, with the specified flags, ensuring it didn't exist
364 before.
365 The file is created read-write (mask at least 0600 & ~umask), but it may be
366 world-readable and world-writable (mask 0666 & ~umask), depending on the
367 implementation.
368 Returns the open file descriptor if successful, otherwise -1 and errno
369 set. */
370 # if !@HAVE_MKOSTEMPS@
371 _GL_FUNCDECL_SYS (mkostemps, int,
372 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
373 _GL_ARG_NONNULL ((1)));
374 # endif
375 _GL_CXXALIAS_SYS (mkostemps, int,
376 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
377 _GL_CXXALIASWARN (mkostemps);
378 #elif defined GNULIB_POSIXCHECK
379 # undef mkostemps
380 # if HAVE_RAW_DECL_MKOSTEMPS
381 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
382 "use gnulib module mkostemps for portability");
383 # endif
384 #endif
386 #if @GNULIB_MKSTEMP@
387 /* Create a unique temporary file from TEMPLATE.
388 The last six characters of TEMPLATE must be "XXXXXX";
389 they are replaced with a string that makes the file name unique.
390 The file is then created, ensuring it didn't exist before.
391 The file is created read-write (mask at least 0600 & ~umask), but it may be
392 world-readable and world-writable (mask 0666 & ~umask), depending on the
393 implementation.
394 Returns the open file descriptor if successful, otherwise -1 and errno
395 set. */
396 # if @REPLACE_MKSTEMP@
397 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
398 # define mkstemp rpl_mkstemp
399 # endif
400 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
401 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
402 # else
403 # if ! @HAVE_MKSTEMP@
404 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
405 # endif
406 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
407 # endif
408 _GL_CXXALIASWARN (mkstemp);
409 #elif defined GNULIB_POSIXCHECK
410 # undef mkstemp
411 # if HAVE_RAW_DECL_MKSTEMP
412 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
413 "use gnulib module mkstemp for portability");
414 # endif
415 #endif
417 #if @GNULIB_MKSTEMPS@
418 /* Create a unique temporary file from TEMPLATE.
419 The last six characters of TEMPLATE prior to a suffix of length
420 SUFFIXLEN must be "XXXXXX";
421 they are replaced with a string that makes the file name unique.
422 The file is then created, ensuring it didn't exist before.
423 The file is created read-write (mask at least 0600 & ~umask), but it may be
424 world-readable and world-writable (mask 0666 & ~umask), depending on the
425 implementation.
426 Returns the open file descriptor if successful, otherwise -1 and errno
427 set. */
428 # if !@HAVE_MKSTEMPS@
429 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
430 _GL_ARG_NONNULL ((1)));
431 # endif
432 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
433 _GL_CXXALIASWARN (mkstemps);
434 #elif defined GNULIB_POSIXCHECK
435 # undef mkstemps
436 # if HAVE_RAW_DECL_MKSTEMPS
437 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
438 "use gnulib module mkstemps for portability");
439 # endif
440 #endif
442 #if @GNULIB_POSIX_OPENPT@
443 /* Return an FD open to the master side of a pseudo-terminal. Flags should
444 include O_RDWR, and may also include O_NOCTTY. */
445 # if !@HAVE_POSIX_OPENPT@
446 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
447 # endif
448 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
449 _GL_CXXALIASWARN (posix_openpt);
450 #elif defined GNULIB_POSIXCHECK
451 # undef posix_openpt
452 # if HAVE_RAW_DECL_POSIX_OPENPT
453 _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
454 "use gnulib module posix_openpt for portability");
455 # endif
456 #endif
458 #if @GNULIB_PTSNAME@
459 /* Return the pathname of the pseudo-terminal slave associated with
460 the master FD is open on, or NULL on errors. */
461 # if @REPLACE_PTSNAME@
462 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
463 # undef ptsname
464 # define ptsname rpl_ptsname
465 # endif
466 _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
467 _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
468 # else
469 # if !@HAVE_PTSNAME@
470 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
471 # endif
472 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
473 # endif
474 _GL_CXXALIASWARN (ptsname);
475 #elif defined GNULIB_POSIXCHECK
476 # undef ptsname
477 # if HAVE_RAW_DECL_PTSNAME
478 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
479 "use gnulib module ptsname for portability");
480 # endif
481 #endif
483 #if @GNULIB_PTSNAME_R@
484 /* Set the pathname of the pseudo-terminal slave associated with
485 the master FD is open on and return 0, or set errno and return
486 non-zero on errors. */
487 # if @REPLACE_PTSNAME_R@
488 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
489 # undef ptsname_r
490 # define ptsname_r rpl_ptsname_r
491 # endif
492 _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
493 _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
494 # else
495 # if !@HAVE_PTSNAME_R@
496 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
497 # endif
498 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
499 # endif
500 _GL_CXXALIASWARN (ptsname_r);
501 #elif defined GNULIB_POSIXCHECK
502 # undef ptsname_r
503 # if HAVE_RAW_DECL_PTSNAME_R
504 _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
505 "use gnulib module ptsname_r for portability");
506 # endif
507 #endif
509 #if @GNULIB_PUTENV@
510 # if @REPLACE_PUTENV@
511 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
512 # undef putenv
513 # define putenv rpl_putenv
514 # endif
515 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
516 _GL_CXXALIAS_RPL (putenv, int, (char *string));
517 # else
518 _GL_CXXALIAS_SYS (putenv, int, (char *string));
519 # endif
520 _GL_CXXALIASWARN (putenv);
521 #endif
523 #if @GNULIB_QSORT_R@
524 /* Sort an array of NMEMB elements, starting at address BASE, each element
525 occupying SIZE bytes, in ascending order according to the comparison
526 function COMPARE. */
527 # if @REPLACE_QSORT_R@
528 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
529 # undef qsort_r
530 # define qsort_r rpl_qsort_r
531 # endif
532 _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
533 int (*compare) (void const *, void const *,
534 void *),
535 void *arg) _GL_ARG_NONNULL ((1, 4)));
536 _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
537 int (*compare) (void const *, void const *,
538 void *),
539 void *arg));
540 # else
541 # if !@HAVE_QSORT_R@
542 _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
543 int (*compare) (void const *, void const *,
544 void *),
545 void *arg) _GL_ARG_NONNULL ((1, 4)));
546 # endif
547 _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
548 int (*compare) (void const *, void const *,
549 void *),
550 void *arg));
551 # endif
552 _GL_CXXALIASWARN (qsort_r);
553 #elif defined GNULIB_POSIXCHECK
554 # undef qsort_r
555 # if HAVE_RAW_DECL_QSORT_R
556 _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
557 "use gnulib module qsort_r for portability");
558 # endif
559 #endif
562 #if @GNULIB_RANDOM_R@
563 # if !@HAVE_RANDOM_R@
564 # ifndef RAND_MAX
565 # define RAND_MAX 2147483647
566 # endif
567 # endif
568 #endif
571 #if @GNULIB_RANDOM@
572 # if !@HAVE_RANDOM@
573 _GL_FUNCDECL_SYS (random, long, (void));
574 # endif
575 _GL_CXXALIAS_SYS (random, long, (void));
576 _GL_CXXALIASWARN (random);
577 #elif defined GNULIB_POSIXCHECK
578 # undef random
579 # if HAVE_RAW_DECL_RANDOM
580 _GL_WARN_ON_USE (random, "random is unportable - "
581 "use gnulib module random for portability");
582 # endif
583 #endif
585 #if @GNULIB_RANDOM@
586 # if !@HAVE_RANDOM@
587 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
588 # endif
589 _GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
590 _GL_CXXALIASWARN (srandom);
591 #elif defined GNULIB_POSIXCHECK
592 # undef srandom
593 # if HAVE_RAW_DECL_SRANDOM
594 _GL_WARN_ON_USE (srandom, "srandom is unportable - "
595 "use gnulib module random for portability");
596 # endif
597 #endif
599 #if @GNULIB_RANDOM@
600 # if !@HAVE_RANDOM@ || !@HAVE_DECL_INITSTATE@
601 _GL_FUNCDECL_SYS (initstate, char *,
602 (unsigned int seed, char *buf, size_t buf_size)
603 _GL_ARG_NONNULL ((2)));
604 # endif
605 _GL_CXXALIAS_SYS (initstate, char *,
606 (unsigned int seed, char *buf, size_t buf_size));
607 _GL_CXXALIASWARN (initstate);
608 #elif defined GNULIB_POSIXCHECK
609 # undef initstate
610 # if HAVE_RAW_DECL_INITSTATE_R
611 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
612 "use gnulib module random for portability");
613 # endif
614 #endif
616 #if @GNULIB_RANDOM@
617 # if !@HAVE_RANDOM@ || !@HAVE_DECL_SETSTATE@
618 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
619 # endif
620 _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
621 _GL_CXXALIASWARN (setstate);
622 #elif defined GNULIB_POSIXCHECK
623 # undef setstate
624 # if HAVE_RAW_DECL_SETSTATE_R
625 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
626 "use gnulib module random for portability");
627 # endif
628 #endif
631 #if @GNULIB_RANDOM_R@
632 # if @REPLACE_RANDOM_R@
633 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
634 # undef random_r
635 # define random_r rpl_random_r
636 # endif
637 _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
638 _GL_ARG_NONNULL ((1, 2)));
639 _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
640 # else
641 # if !@HAVE_RANDOM_R@
642 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
643 _GL_ARG_NONNULL ((1, 2)));
644 # endif
645 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
646 # endif
647 _GL_CXXALIASWARN (random_r);
648 #elif defined GNULIB_POSIXCHECK
649 # undef random_r
650 # if HAVE_RAW_DECL_RANDOM_R
651 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
652 "use gnulib module random_r for portability");
653 # endif
654 #endif
656 #if @GNULIB_RANDOM_R@
657 # if @REPLACE_RANDOM_R@
658 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
659 # undef srandom_r
660 # define srandom_r rpl_srandom_r
661 # endif
662 _GL_FUNCDECL_RPL (srandom_r, int,
663 (unsigned int seed, struct random_data *rand_state)
664 _GL_ARG_NONNULL ((2)));
665 _GL_CXXALIAS_RPL (srandom_r, int,
666 (unsigned int seed, struct random_data *rand_state));
667 # else
668 # if !@HAVE_RANDOM_R@
669 _GL_FUNCDECL_SYS (srandom_r, int,
670 (unsigned int seed, struct random_data *rand_state)
671 _GL_ARG_NONNULL ((2)));
672 # endif
673 _GL_CXXALIAS_SYS (srandom_r, int,
674 (unsigned int seed, struct random_data *rand_state));
675 # endif
676 _GL_CXXALIASWARN (srandom_r);
677 #elif defined GNULIB_POSIXCHECK
678 # undef srandom_r
679 # if HAVE_RAW_DECL_SRANDOM_R
680 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
681 "use gnulib module random_r for portability");
682 # endif
683 #endif
685 #if @GNULIB_RANDOM_R@
686 # if @REPLACE_RANDOM_R@
687 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
688 # undef initstate_r
689 # define initstate_r rpl_initstate_r
690 # endif
691 _GL_FUNCDECL_RPL (initstate_r, int,
692 (unsigned int seed, char *buf, size_t buf_size,
693 struct random_data *rand_state)
694 _GL_ARG_NONNULL ((2, 4)));
695 _GL_CXXALIAS_RPL (initstate_r, int,
696 (unsigned int seed, char *buf, size_t buf_size,
697 struct random_data *rand_state));
698 # else
699 # if !@HAVE_RANDOM_R@
700 _GL_FUNCDECL_SYS (initstate_r, int,
701 (unsigned int seed, char *buf, size_t buf_size,
702 struct random_data *rand_state)
703 _GL_ARG_NONNULL ((2, 4)));
704 # endif
705 _GL_CXXALIAS_SYS (initstate_r, int,
706 (unsigned int seed, char *buf, size_t buf_size,
707 struct random_data *rand_state));
708 # endif
709 _GL_CXXALIASWARN (initstate_r);
710 #elif defined GNULIB_POSIXCHECK
711 # undef initstate_r
712 # if HAVE_RAW_DECL_INITSTATE_R
713 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
714 "use gnulib module random_r for portability");
715 # endif
716 #endif
718 #if @GNULIB_RANDOM_R@
719 # if @REPLACE_RANDOM_R@
720 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
721 # undef setstate_r
722 # define setstate_r rpl_setstate_r
723 # endif
724 _GL_FUNCDECL_RPL (setstate_r, int,
725 (char *arg_state, struct random_data *rand_state)
726 _GL_ARG_NONNULL ((1, 2)));
727 _GL_CXXALIAS_RPL (setstate_r, int,
728 (char *arg_state, struct random_data *rand_state));
729 # else
730 # if !@HAVE_RANDOM_R@
731 _GL_FUNCDECL_SYS (setstate_r, int,
732 (char *arg_state, struct random_data *rand_state)
733 _GL_ARG_NONNULL ((1, 2)));
734 # endif
735 _GL_CXXALIAS_SYS (setstate_r, int,
736 (char *arg_state, struct random_data *rand_state));
737 # endif
738 _GL_CXXALIASWARN (setstate_r);
739 #elif defined GNULIB_POSIXCHECK
740 # undef setstate_r
741 # if HAVE_RAW_DECL_SETSTATE_R
742 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
743 "use gnulib module random_r for portability");
744 # endif
745 #endif
748 #if @GNULIB_REALLOC_POSIX@
749 # if @REPLACE_REALLOC@
750 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
751 || _GL_USE_STDLIB_ALLOC)
752 # undef realloc
753 # define realloc rpl_realloc
754 # endif
755 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
756 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
757 # else
758 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
759 # endif
760 _GL_CXXALIASWARN (realloc);
761 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
762 # undef realloc
763 /* Assume realloc is always declared. */
764 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
765 "use gnulib module realloc-posix for portability");
766 #endif
769 #if @GNULIB_REALLOCARRAY@
770 # if ! @HAVE_REALLOCARRAY@
771 _GL_FUNCDECL_SYS (reallocarray, void *,
772 (void *ptr, size_t nmemb, size_t size));
773 # endif
774 _GL_CXXALIAS_SYS (reallocarray, void *,
775 (void *ptr, size_t nmemb, size_t size));
776 _GL_CXXALIASWARN (reallocarray);
777 #elif defined GNULIB_POSIXCHECK
778 # undef reallocarray
779 # if HAVE_RAW_DECL_REALLOCARRAY
780 _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
781 "use gnulib module reallocarray for portability");
782 # endif
783 #endif
785 #if @GNULIB_REALPATH@
786 # if @REPLACE_REALPATH@
787 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
788 # define realpath rpl_realpath
789 # endif
790 _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
791 _GL_ARG_NONNULL ((1)));
792 _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
793 # else
794 # if !@HAVE_REALPATH@
795 _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
796 _GL_ARG_NONNULL ((1)));
797 # endif
798 _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
799 # endif
800 _GL_CXXALIASWARN (realpath);
801 #elif defined GNULIB_POSIXCHECK
802 # undef realpath
803 # if HAVE_RAW_DECL_REALPATH
804 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
805 "canonicalize or canonicalize-lgpl for portability");
806 # endif
807 #endif
809 #if @GNULIB_RPMATCH@
810 /* Test a user response to a question.
811 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
812 # if !@HAVE_RPMATCH@
813 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
814 # endif
815 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
816 _GL_CXXALIASWARN (rpmatch);
817 #elif defined GNULIB_POSIXCHECK
818 # undef rpmatch
819 # if HAVE_RAW_DECL_RPMATCH
820 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
821 "use gnulib module rpmatch for portability");
822 # endif
823 #endif
825 #if @GNULIB_SECURE_GETENV@
826 /* Look up NAME in the environment, returning 0 in insecure situations. */
827 # if !@HAVE_SECURE_GETENV@
828 _GL_FUNCDECL_SYS (secure_getenv, char *,
829 (char const *name) _GL_ARG_NONNULL ((1)));
830 # endif
831 _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
832 _GL_CXXALIASWARN (secure_getenv);
833 #elif defined GNULIB_POSIXCHECK
834 # undef secure_getenv
835 # if HAVE_RAW_DECL_SECURE_GETENV
836 _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
837 "use gnulib module secure_getenv for portability");
838 # endif
839 #endif
841 #if @GNULIB_SETENV@
842 /* Set NAME to VALUE in the environment.
843 If REPLACE is nonzero, overwrite an existing value. */
844 # if @REPLACE_SETENV@
845 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
846 # undef setenv
847 # define setenv rpl_setenv
848 # endif
849 _GL_FUNCDECL_RPL (setenv, int,
850 (const char *name, const char *value, int replace)
851 _GL_ARG_NONNULL ((1)));
852 _GL_CXXALIAS_RPL (setenv, int,
853 (const char *name, const char *value, int replace));
854 # else
855 # if !@HAVE_DECL_SETENV@
856 _GL_FUNCDECL_SYS (setenv, int,
857 (const char *name, const char *value, int replace)
858 _GL_ARG_NONNULL ((1)));
859 # endif
860 _GL_CXXALIAS_SYS (setenv, int,
861 (const char *name, const char *value, int replace));
862 # endif
863 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
864 _GL_CXXALIASWARN (setenv);
865 # endif
866 #elif defined GNULIB_POSIXCHECK
867 # undef setenv
868 # if HAVE_RAW_DECL_SETENV
869 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
870 "use gnulib module setenv for portability");
871 # endif
872 #endif
874 #if @GNULIB_STRTOD@
875 /* Parse a double from STRING, updating ENDP if appropriate. */
876 # if @REPLACE_STRTOD@
877 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
878 # define strtod rpl_strtod
879 # endif
880 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
881 _GL_ARG_NONNULL ((1)));
882 _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
883 # else
884 # if !@HAVE_STRTOD@
885 _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
886 _GL_ARG_NONNULL ((1)));
887 # endif
888 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
889 # endif
890 _GL_CXXALIASWARN (strtod);
891 #elif defined GNULIB_POSIXCHECK
892 # undef strtod
893 # if HAVE_RAW_DECL_STRTOD
894 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
895 "use gnulib module strtod for portability");
896 # endif
897 #endif
899 #if @GNULIB_STRTOLL@
900 /* Parse a signed integer whose textual representation starts at STRING.
901 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
902 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
903 "0x").
904 If ENDPTR is not NULL, the address of the first byte after the integer is
905 stored in *ENDPTR.
906 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
907 to ERANGE. */
908 # if !@HAVE_STRTOLL@
909 _GL_FUNCDECL_SYS (strtoll, long long,
910 (const char *string, char **endptr, int base)
911 _GL_ARG_NONNULL ((1)));
912 # endif
913 _GL_CXXALIAS_SYS (strtoll, long long,
914 (const char *string, char **endptr, int base));
915 _GL_CXXALIASWARN (strtoll);
916 #elif defined GNULIB_POSIXCHECK
917 # undef strtoll
918 # if HAVE_RAW_DECL_STRTOLL
919 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
920 "use gnulib module strtoll for portability");
921 # endif
922 #endif
924 #if @GNULIB_STRTOULL@
925 /* Parse an unsigned integer whose textual representation starts at STRING.
926 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
927 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
928 "0x").
929 If ENDPTR is not NULL, the address of the first byte after the integer is
930 stored in *ENDPTR.
931 Upon overflow, the return value is ULLONG_MAX, and errno is set to
932 ERANGE. */
933 # if !@HAVE_STRTOULL@
934 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
935 (const char *string, char **endptr, int base)
936 _GL_ARG_NONNULL ((1)));
937 # endif
938 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
939 (const char *string, char **endptr, int base));
940 _GL_CXXALIASWARN (strtoull);
941 #elif defined GNULIB_POSIXCHECK
942 # undef strtoull
943 # if HAVE_RAW_DECL_STRTOULL
944 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
945 "use gnulib module strtoull for portability");
946 # endif
947 #endif
949 #if @GNULIB_UNLOCKPT@
950 /* Unlock the slave side of the pseudo-terminal whose master side is specified
951 by FD, so that it can be opened. */
952 # if !@HAVE_UNLOCKPT@
953 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
954 # endif
955 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
956 _GL_CXXALIASWARN (unlockpt);
957 #elif defined GNULIB_POSIXCHECK
958 # undef unlockpt
959 # if HAVE_RAW_DECL_UNLOCKPT
960 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
961 "use gnulib module unlockpt for portability");
962 # endif
963 #endif
965 #if @GNULIB_UNSETENV@
966 /* Remove the variable NAME from the environment. */
967 # if @REPLACE_UNSETENV@
968 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
969 # undef unsetenv
970 # define unsetenv rpl_unsetenv
971 # endif
972 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
973 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
974 # else
975 # if !@HAVE_DECL_UNSETENV@
976 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
977 # endif
978 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
979 # endif
980 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
981 _GL_CXXALIASWARN (unsetenv);
982 # endif
983 #elif defined GNULIB_POSIXCHECK
984 # undef unsetenv
985 # if HAVE_RAW_DECL_UNSETENV
986 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
987 "use gnulib module unsetenv for portability");
988 # endif
989 #endif
991 /* Convert a wide character to a multibyte character. */
992 #if @GNULIB_WCTOMB@
993 # if @REPLACE_WCTOMB@
994 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
995 # undef wctomb
996 # define wctomb rpl_wctomb
997 # endif
998 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
999 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1000 # else
1001 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
1002 # endif
1003 _GL_CXXALIASWARN (wctomb);
1004 #endif
1007 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1008 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1009 #endif