peval uses effects analysis
[bpt/guile.git] / lib / stdlib.in.h
CommitLineData
f240aacb
LC
1/* A GNU-like <stdlib.h>.
2
f0007cad 3 Copyright (C) 1995, 2001-2004, 2006-2012 Free Software Foundation, Inc.
f240aacb
LC
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
0f00f2c3 21@PRAGMA_COLUMNS@
f240aacb
LC
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
3d458a81 31#ifndef _@GUARD_PREFIX@_STDLIB_H
f240aacb
LC
32
33/* The include_next requires a split double-inclusion guard. */
34#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
35
3d458a81
AW
36#ifndef _@GUARD_PREFIX@_STDLIB_H
37#define _@GUARD_PREFIX@_STDLIB_H
f240aacb 38
8912421c
LC
39/* NetBSD 5.0 mis-defines NULL. */
40#include <stddef.h>
f240aacb 41
0f00f2c3
LC
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
f240aacb 47/* Solaris declares getloadavg() in <sys/loadavg.h>. */
61cd9dc9 48#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
f240aacb
LC
49# include <sys/loadavg.h>
50#endif
51
f0007cad
LC
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
49114fd4
LC
57#if @GNULIB_RANDOM_R@
58
f240aacb 59/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
49114fd4
LC
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
f240aacb 65
f0007cad 66# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
49114fd4
LC
67# include <stdint.h>
68# endif
f240aacb 69
49114fd4 70# if !@HAVE_STRUCT_RANDOM_DATA@
0f00f2c3
LC
71/* Define 'struct random_data'.
72 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
49114fd4 73# if !GNULIB_defined_struct_random_data
f240aacb
LC
74struct random_data
75{
1cd4fffc
LC
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. */
f240aacb 83};
49114fd4
LC
84# define GNULIB_defined_struct_random_data 1
85# endif
0f00f2c3 86# endif
f240aacb
LC
87#endif
88
3d458a81 89#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
61cd9dc9 90/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
3d458a81 91/* On MacOS X 10.5, only <unistd.h> declares mkstemps. */
61cd9dc9 92/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
a927b6c1 93/* But avoid namespace pollution on glibc systems and native Windows. */
61cd9dc9
LC
94# include <unistd.h>
95#endif
f240aacb 96
35428fb6 97/* The definition of _Noreturn is copied here. */
9157d901 98
f4c79b3c
LC
99/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
100
1cd4fffc
LC
101/* The definition of _GL_ARG_NONNULL is copied here. */
102
61cd9dc9
LC
103/* The definition of _GL_WARN_ON_USE is copied here. */
104
f240aacb
LC
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
9157d901
LC
120#if @GNULIB__EXIT@
121/* Terminate the current process with the given return code, without running
122 the 'atexit' handlers. */
123# if !@HAVE__EXIT@
35428fb6 124_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
9157d901
LC
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
8912421c 137#if @GNULIB_ATOLL@
8912421c
LC
138/* Parse a signed decimal integer.
139 Returns the value of the integer. Errors are not detected. */
f4c79b3c
LC
140# if !@HAVE_ATOLL@
141_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
f240aacb 142# endif
f4c79b3c
LC
143_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
144_GL_CXXALIASWARN (atoll);
f240aacb 145#elif defined GNULIB_POSIXCHECK
8912421c 146# undef atoll
61cd9dc9
LC
147# if HAVE_RAW_DECL_ATOLL
148_GL_WARN_ON_USE (atoll, "atoll is unportable - "
149 "use gnulib module atoll for portability");
150# endif
f240aacb
LC
151#endif
152
f240aacb 153#if @GNULIB_CALLOC_POSIX@
9157d901 154# if @REPLACE_CALLOC@
f4c79b3c
LC
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));
f240aacb 163# endif
f4c79b3c 164_GL_CXXALIASWARN (calloc);
f240aacb
LC
165#elif defined GNULIB_POSIXCHECK
166# undef calloc
61cd9dc9
LC
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");
f240aacb
LC
170#endif
171
8912421c
LC
172#if @GNULIB_CANONICALIZE_FILE_NAME@
173# if @REPLACE_CANONICALIZE_FILE_NAME@
f4c79b3c
LC
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));
f240aacb 186# endif
f4c79b3c 187_GL_CXXALIASWARN (canonicalize_file_name);
f240aacb 188#elif defined GNULIB_POSIXCHECK
8912421c 189# undef canonicalize_file_name
61cd9dc9 190# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
0f00f2c3
LC
191_GL_WARN_ON_USE (canonicalize_file_name,
192 "canonicalize_file_name is unportable - "
61cd9dc9
LC
193 "use gnulib module canonicalize-lgpl for portability");
194# endif
f240aacb
LC
195#endif
196
f240aacb 197#if @GNULIB_GETLOADAVG@
f240aacb
LC
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. */
f4c79b3c
LC
202# if !@HAVE_DECL_GETLOADAVG@
203_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
204 _GL_ARG_NONNULL ((1)));
f240aacb 205# endif
f4c79b3c
LC
206_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
207_GL_CXXALIASWARN (getloadavg);
f240aacb
LC
208#elif defined GNULIB_POSIXCHECK
209# undef getloadavg
61cd9dc9
LC
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
f240aacb
LC
214#endif
215
f240aacb
LC
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@
f4c79b3c
LC
229_GL_FUNCDECL_SYS (getsubopt, int,
230 (char **optionp, char *const *tokens, char **valuep)
231 _GL_ARG_NONNULL ((1, 2, 3)));
f240aacb 232# endif
f4c79b3c
LC
233_GL_CXXALIAS_SYS (getsubopt, int,
234 (char **optionp, char *const *tokens, char **valuep));
235_GL_CXXALIASWARN (getsubopt);
f240aacb
LC
236#elif defined GNULIB_POSIXCHECK
237# undef getsubopt
61cd9dc9
LC
238# if HAVE_RAW_DECL_GETSUBOPT
239_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
240 "use gnulib module getsubopt for portability");
241# endif
f240aacb
LC
242#endif
243
a927b6c1
LC
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
7f1ea859 255_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
a927b6c1
LC
256 "use gnulib module grantpt for portability");
257# endif
258#endif
259
dd7d0148
LC
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. */
8912421c 264#if @GNULIB_MALLOC_POSIX@
9157d901 265# if @REPLACE_MALLOC@
dd7d0148
LC
266# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
267 || _GL_USE_STDLIB_ALLOC)
f4c79b3c
LC
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));
8912421c 275# endif
f4c79b3c 276_GL_CXXALIASWARN (malloc);
dd7d0148 277#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
8912421c 278# undef malloc
61cd9dc9
LC
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");
8912421c 282#endif
f240aacb 283
dd36ce77
MW
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
f240aacb 299#if @GNULIB_MKDTEMP@
f240aacb
LC
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. */
f4c79b3c
LC
305# if !@HAVE_MKDTEMP@
306_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
f240aacb 307# endif
f4c79b3c
LC
308_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
309_GL_CXXALIASWARN (mkdtemp);
f240aacb
LC
310#elif defined GNULIB_POSIXCHECK
311# undef mkdtemp
61cd9dc9
LC
312# if HAVE_RAW_DECL_MKDTEMP
313_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
314 "use gnulib module mkdtemp for portability");
315# endif
f240aacb
LC
316#endif
317
8912421c 318#if @GNULIB_MKOSTEMP@
8912421c
LC
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. */
f4c79b3c
LC
331# if !@HAVE_MKOSTEMP@
332_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
333 _GL_ARG_NONNULL ((1)));
8912421c 334# endif
f4c79b3c
LC
335_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
336_GL_CXXALIASWARN (mkostemp);
8912421c
LC
337#elif defined GNULIB_POSIXCHECK
338# undef mkostemp
61cd9dc9
LC
339# if HAVE_RAW_DECL_MKOSTEMP
340_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
341 "use gnulib module mkostemp for portability");
342# endif
8912421c 343#endif
f240aacb 344
f29ded4b 345#if @GNULIB_MKOSTEMPS@
f29ded4b
LC
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. */
f4c79b3c
LC
359# if !@HAVE_MKOSTEMPS@
360_GL_FUNCDECL_SYS (mkostemps, int,
361 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
362 _GL_ARG_NONNULL ((1)));
f29ded4b 363# endif
f4c79b3c
LC
364_GL_CXXALIAS_SYS (mkostemps, int,
365 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
366_GL_CXXALIASWARN (mkostemps);
f29ded4b
LC
367#elif defined GNULIB_POSIXCHECK
368# undef mkostemps
61cd9dc9
LC
369# if HAVE_RAW_DECL_MKOSTEMPS
370_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
371 "use gnulib module mkostemps for portability");
372# endif
f29ded4b
LC
373#endif
374
f240aacb 375#if @GNULIB_MKSTEMP@
f240aacb
LC
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. */
f4c79b3c
LC
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
a927b6c1
LC
392# if ! @HAVE_MKSTEMP@
393_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
394# endif
f4c79b3c 395_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
f240aacb 396# endif
f4c79b3c 397_GL_CXXALIASWARN (mkstemp);
f240aacb
LC
398#elif defined GNULIB_POSIXCHECK
399# undef mkstemp
61cd9dc9
LC
400# if HAVE_RAW_DECL_MKSTEMP
401_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
402 "use gnulib module mkstemp for portability");
403# endif
f240aacb
LC
404#endif
405
f29ded4b 406#if @GNULIB_MKSTEMPS@
f29ded4b
LC
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. */
f4c79b3c
LC
417# if !@HAVE_MKSTEMPS@
418_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
419 _GL_ARG_NONNULL ((1)));
f29ded4b 420# endif
f4c79b3c
LC
421_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
422_GL_CXXALIASWARN (mkstemps);
f29ded4b
LC
423#elif defined GNULIB_POSIXCHECK
424# undef mkstemps
61cd9dc9
LC
425# if HAVE_RAW_DECL_MKSTEMPS
426_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
427 "use gnulib module mkstemps for portability");
428# endif
f29ded4b
LC
429#endif
430
35428fb6
LC
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
a927b6c1
LC
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
7f1ea859
LC
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
f240aacb
LC
489#if @GNULIB_PUTENV@
490# if @REPLACE_PUTENV@
f4c79b3c
LC
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));
f240aacb 499# endif
f4c79b3c 500_GL_CXXALIASWARN (putenv);
f240aacb
LC
501#endif
502
f4c79b3c 503
f240aacb
LC
504#if @GNULIB_RANDOM_R@
505# if !@HAVE_RANDOM_R@
f240aacb
LC
506# ifndef RAND_MAX
507# define RAND_MAX 2147483647
508# endif
f4c79b3c
LC
509# endif
510#endif
f240aacb 511
f0007cad
LC
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
f4c79b3c 573#if @GNULIB_RANDOM_R@
f0007cad
LC
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@
f4c79b3c
LC
584_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
585 _GL_ARG_NONNULL ((1, 2)));
f0007cad 586# endif
f4c79b3c 587_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
f0007cad 588# endif
f4c79b3c 589_GL_CXXALIASWARN (random_r);
f240aacb
LC
590#elif defined GNULIB_POSIXCHECK
591# undef random_r
61cd9dc9
LC
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
f4c79b3c
LC
596#endif
597
598#if @GNULIB_RANDOM_R@
f0007cad
LC
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@
f4c79b3c
LC
611_GL_FUNCDECL_SYS (srandom_r, int,
612 (unsigned int seed, struct random_data *rand_state)
613 _GL_ARG_NONNULL ((2)));
f0007cad 614# endif
f4c79b3c
LC
615_GL_CXXALIAS_SYS (srandom_r, int,
616 (unsigned int seed, struct random_data *rand_state));
f0007cad 617# endif
f4c79b3c
LC
618_GL_CXXALIASWARN (srandom_r);
619#elif defined GNULIB_POSIXCHECK
f240aacb 620# undef srandom_r
61cd9dc9
LC
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
f4c79b3c
LC
625#endif
626
627#if @GNULIB_RANDOM_R@
f0007cad
LC
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@
f4c79b3c
LC
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)));
f0007cad 646# endif
f4c79b3c
LC
647_GL_CXXALIAS_SYS (initstate_r, int,
648 (unsigned int seed, char *buf, size_t buf_size,
649 struct random_data *rand_state));
f0007cad 650# endif
f4c79b3c
LC
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@
f0007cad
LC
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@
f4c79b3c
LC
673_GL_FUNCDECL_SYS (setstate_r, int,
674 (char *arg_state, struct random_data *rand_state)
675 _GL_ARG_NONNULL ((1, 2)));
f0007cad 676# endif
f4c79b3c
LC
677_GL_CXXALIAS_SYS (setstate_r, int,
678 (char *arg_state, struct random_data *rand_state));
f0007cad 679# endif
f4c79b3c
LC
680_GL_CXXALIASWARN (setstate_r);
681#elif defined GNULIB_POSIXCHECK
f240aacb 682# undef setstate_r
61cd9dc9
LC
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
f240aacb
LC
687#endif
688
f4c79b3c 689
8912421c 690#if @GNULIB_REALLOC_POSIX@
9157d901 691# if @REPLACE_REALLOC@
dd7d0148
LC
692# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
693 || _GL_USE_STDLIB_ALLOC)
f4c79b3c
LC
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));
8912421c 701# endif
f4c79b3c 702_GL_CXXALIASWARN (realloc);
dd7d0148 703#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
8912421c 704# undef realloc
61cd9dc9
LC
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");
8912421c
LC
708#endif
709
710#if @GNULIB_REALPATH@
711# if @REPLACE_REALPATH@
f4c79b3c
LC
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));
8912421c 724# endif
f4c79b3c 725_GL_CXXALIASWARN (realpath);
8912421c
LC
726#elif defined GNULIB_POSIXCHECK
727# undef realpath
61cd9dc9
LC
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
8912421c 732#endif
f240aacb
LC
733
734#if @GNULIB_RPMATCH@
f240aacb
LC
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. */
f4c79b3c
LC
737# if !@HAVE_RPMATCH@
738_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
f240aacb 739# endif
f4c79b3c
LC
740_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
741_GL_CXXALIASWARN (rpmatch);
f240aacb
LC
742#elif defined GNULIB_POSIXCHECK
743# undef rpmatch
61cd9dc9
LC
744# if HAVE_RAW_DECL_RPMATCH
745_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
746 "use gnulib module rpmatch for portability");
747# endif
f240aacb
LC
748#endif
749
f240aacb 750#if @GNULIB_SETENV@
f240aacb
LC
751/* Set NAME to VALUE in the environment.
752 If REPLACE is nonzero, overwrite an existing value. */
f4c79b3c
LC
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
ab4d62ad 764# if !@HAVE_DECL_SETENV@
f4c79b3c
LC
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));
f240aacb 771# endif
ab4d62ad 772# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
f4c79b3c 773_GL_CXXALIASWARN (setenv);
ab4d62ad 774# endif
4f02b98d
LC
775#elif defined GNULIB_POSIXCHECK
776# undef setenv
61cd9dc9
LC
777# if HAVE_RAW_DECL_SETENV
778_GL_WARN_ON_USE (setenv, "setenv is unportable - "
779 "use gnulib module setenv for portability");
780# endif
f240aacb
LC
781#endif
782
f240aacb 783#if @GNULIB_STRTOD@
f240aacb 784 /* Parse a double from STRING, updating ENDP if appropriate. */
f4c79b3c
LC
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));
f240aacb 798# endif
f4c79b3c 799_GL_CXXALIASWARN (strtod);
f240aacb
LC
800#elif defined GNULIB_POSIXCHECK
801# undef strtod
61cd9dc9
LC
802# if HAVE_RAW_DECL_STRTOD
803_GL_WARN_ON_USE (strtod, "strtod is unportable - "
804 "use gnulib module strtod for portability");
805# endif
f240aacb
LC
806#endif
807
f240aacb 808#if @GNULIB_STRTOLL@
f240aacb
LC
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. */
f4c79b3c
LC
817# if !@HAVE_STRTOLL@
818_GL_FUNCDECL_SYS (strtoll, long long,
819 (const char *string, char **endptr, int base)
820 _GL_ARG_NONNULL ((1)));
f240aacb 821# endif
f4c79b3c
LC
822_GL_CXXALIAS_SYS (strtoll, long long,
823 (const char *string, char **endptr, int base));
824_GL_CXXALIASWARN (strtoll);
f240aacb
LC
825#elif defined GNULIB_POSIXCHECK
826# undef strtoll
61cd9dc9
LC
827# if HAVE_RAW_DECL_STRTOLL
828_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
829 "use gnulib module strtoll for portability");
830# endif
f240aacb
LC
831#endif
832
f240aacb 833#if @GNULIB_STRTOULL@
f240aacb
LC
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. */
f4c79b3c
LC
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)));
f240aacb 846# endif
f4c79b3c
LC
847_GL_CXXALIAS_SYS (strtoull, unsigned long long,
848 (const char *string, char **endptr, int base));
849_GL_CXXALIASWARN (strtoull);
f240aacb
LC
850#elif defined GNULIB_POSIXCHECK
851# undef strtoull
61cd9dc9
LC
852# if HAVE_RAW_DECL_STRTOULL
853_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
854 "use gnulib module strtoull for portability");
855# endif
f240aacb
LC
856#endif
857
a927b6c1
LC
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
0f00f2c3 869_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
a927b6c1
LC
870 "use gnulib module unlockpt for portability");
871# endif
872#endif
873
8912421c 874#if @GNULIB_UNSETENV@
8912421c 875/* Remove the variable NAME from the environment. */
f4c79b3c
LC
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
ab4d62ad 884# if !@HAVE_DECL_UNSETENV@
f4c79b3c
LC
885_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
886# endif
887_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
8912421c 888# endif
ab4d62ad 889# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
f4c79b3c 890_GL_CXXALIASWARN (unsetenv);
ab4d62ad 891# endif
4f02b98d
LC
892#elif defined GNULIB_POSIXCHECK
893# undef unsetenv
61cd9dc9
LC
894# if HAVE_RAW_DECL_UNSETENV
895_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
896 "use gnulib module unsetenv for portability");
897# endif
8912421c 898#endif
f240aacb 899
dd36ce77
MW
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
f240aacb 915
3d458a81
AW
916#endif /* _@GUARD_PREFIX@_STDLIB_H */
917#endif /* _@GUARD_PREFIX@_STDLIB_H */
f240aacb 918#endif