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