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