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