Import Gnulib's `log1p' and `round' modules.
[bpt/guile.git] / lib / stdlib.in.h
CommitLineData
f240aacb
LC
1/* A GNU-like <stdlib.h>.
2
49114fd4 3 Copyright (C) 1995, 2001-2004, 2006-2011 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
31#ifndef _GL_STDLIB_H
32
33/* The include_next requires a split double-inclusion guard. */
34#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
35
36#ifndef _GL_STDLIB_H
37#define _GL_STDLIB_H
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
49114fd4
LC
52#if @GNULIB_RANDOM_R@
53
f240aacb 54/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
49114fd4
LC
55 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
56 'struct random_data'. */
57# if @HAVE_RANDOM_H@
58# include <random.h>
59# endif
f240aacb 60
49114fd4
LC
61# if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@
62# include <stdint.h>
63# endif
f240aacb 64
49114fd4 65# if !@HAVE_STRUCT_RANDOM_DATA@
0f00f2c3
LC
66/* Define 'struct random_data'.
67 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
49114fd4 68# if !GNULIB_defined_struct_random_data
f240aacb
LC
69struct random_data
70{
1cd4fffc
LC
71 int32_t *fptr; /* Front pointer. */
72 int32_t *rptr; /* Rear pointer. */
73 int32_t *state; /* Array of state values. */
74 int rand_type; /* Type of random number generator. */
75 int rand_deg; /* Degree of random number generator. */
76 int rand_sep; /* Distance between front and rear. */
77 int32_t *end_ptr; /* Pointer behind state table. */
f240aacb 78};
49114fd4
LC
79# define GNULIB_defined_struct_random_data 1
80# endif
0f00f2c3 81# endif
f240aacb
LC
82#endif
83
a927b6c1 84#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
61cd9dc9
LC
85/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
86/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
a927b6c1 87/* But avoid namespace pollution on glibc systems and native Windows. */
61cd9dc9
LC
88# include <unistd.h>
89#endif
f240aacb 90
49114fd4
LC
91#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__
92# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
93#else
94# define _GL_ATTRIBUTE_NORETURN
9157d901
LC
95#endif
96
f4c79b3c
LC
97/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
98
1cd4fffc
LC
99/* The definition of _GL_ARG_NONNULL is copied here. */
100
61cd9dc9
LC
101/* The definition of _GL_WARN_ON_USE is copied here. */
102
f240aacb
LC
103
104/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
105#ifndef EXIT_SUCCESS
106# define EXIT_SUCCESS 0
107#endif
108/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
109 with proper operation of xargs. */
110#ifndef EXIT_FAILURE
111# define EXIT_FAILURE 1
112#elif EXIT_FAILURE != 1
113# undef EXIT_FAILURE
114# define EXIT_FAILURE 1
115#endif
116
117
9157d901
LC
118#if @GNULIB__EXIT@
119/* Terminate the current process with the given return code, without running
120 the 'atexit' handlers. */
121# if !@HAVE__EXIT@
49114fd4 122_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN);
9157d901
LC
123# endif
124_GL_CXXALIAS_SYS (_Exit, void, (int status));
125_GL_CXXALIASWARN (_Exit);
126#elif defined GNULIB_POSIXCHECK
127# undef _Exit
128# if HAVE_RAW_DECL__EXIT
129_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
130 "use gnulib module _Exit for portability");
131# endif
132#endif
133
134
8912421c 135#if @GNULIB_ATOLL@
8912421c
LC
136/* Parse a signed decimal integer.
137 Returns the value of the integer. Errors are not detected. */
f4c79b3c
LC
138# if !@HAVE_ATOLL@
139_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
f240aacb 140# endif
f4c79b3c
LC
141_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
142_GL_CXXALIASWARN (atoll);
f240aacb 143#elif defined GNULIB_POSIXCHECK
8912421c 144# undef atoll
61cd9dc9
LC
145# if HAVE_RAW_DECL_ATOLL
146_GL_WARN_ON_USE (atoll, "atoll is unportable - "
147 "use gnulib module atoll for portability");
148# endif
f240aacb
LC
149#endif
150
f240aacb 151#if @GNULIB_CALLOC_POSIX@
9157d901 152# if @REPLACE_CALLOC@
f4c79b3c
LC
153# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
154# undef calloc
155# define calloc rpl_calloc
156# endif
157_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
158_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
159# else
160_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
f240aacb 161# endif
f4c79b3c 162_GL_CXXALIASWARN (calloc);
f240aacb
LC
163#elif defined GNULIB_POSIXCHECK
164# undef calloc
61cd9dc9
LC
165/* Assume calloc is always declared. */
166_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
167 "use gnulib module calloc-posix for portability");
f240aacb
LC
168#endif
169
8912421c
LC
170#if @GNULIB_CANONICALIZE_FILE_NAME@
171# if @REPLACE_CANONICALIZE_FILE_NAME@
f4c79b3c
LC
172# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
173# define canonicalize_file_name rpl_canonicalize_file_name
174# endif
175_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
176 _GL_ARG_NONNULL ((1)));
177_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
178# else
179# if !@HAVE_CANONICALIZE_FILE_NAME@
180_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
181 _GL_ARG_NONNULL ((1)));
182# endif
183_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
f240aacb 184# endif
f4c79b3c 185_GL_CXXALIASWARN (canonicalize_file_name);
f240aacb 186#elif defined GNULIB_POSIXCHECK
8912421c 187# undef canonicalize_file_name
61cd9dc9 188# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
0f00f2c3
LC
189_GL_WARN_ON_USE (canonicalize_file_name,
190 "canonicalize_file_name is unportable - "
61cd9dc9
LC
191 "use gnulib module canonicalize-lgpl for portability");
192# endif
f240aacb
LC
193#endif
194
f240aacb 195#if @GNULIB_GETLOADAVG@
f240aacb
LC
196/* Store max(NELEM,3) load average numbers in LOADAVG[].
197 The three numbers are the load average of the last 1 minute, the last 5
198 minutes, and the last 15 minutes, respectively.
199 LOADAVG is an array of NELEM numbers. */
f4c79b3c
LC
200# if !@HAVE_DECL_GETLOADAVG@
201_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
202 _GL_ARG_NONNULL ((1)));
f240aacb 203# endif
f4c79b3c
LC
204_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
205_GL_CXXALIASWARN (getloadavg);
f240aacb
LC
206#elif defined GNULIB_POSIXCHECK
207# undef getloadavg
61cd9dc9
LC
208# if HAVE_RAW_DECL_GETLOADAVG
209_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
210 "use gnulib module getloadavg for portability");
211# endif
f240aacb
LC
212#endif
213
f240aacb
LC
214#if @GNULIB_GETSUBOPT@
215/* Assuming *OPTIONP is a comma separated list of elements of the form
216 "token" or "token=value", getsubopt parses the first of these elements.
217 If the first element refers to a "token" that is member of the given
218 NULL-terminated array of tokens:
219 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
220 the first option and the comma, sets *VALUEP to the value of the
221 element (or NULL if it doesn't contain an "=" sign),
222 - It returns the index of the "token" in the given array of tokens.
223 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
224 For more details see the POSIX:2001 specification.
225 http://www.opengroup.org/susv3xsh/getsubopt.html */
226# if !@HAVE_GETSUBOPT@
f4c79b3c
LC
227_GL_FUNCDECL_SYS (getsubopt, int,
228 (char **optionp, char *const *tokens, char **valuep)
229 _GL_ARG_NONNULL ((1, 2, 3)));
f240aacb 230# endif
f4c79b3c
LC
231_GL_CXXALIAS_SYS (getsubopt, int,
232 (char **optionp, char *const *tokens, char **valuep));
233_GL_CXXALIASWARN (getsubopt);
f240aacb
LC
234#elif defined GNULIB_POSIXCHECK
235# undef getsubopt
61cd9dc9
LC
236# if HAVE_RAW_DECL_GETSUBOPT
237_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
238 "use gnulib module getsubopt for portability");
239# endif
f240aacb
LC
240#endif
241
a927b6c1
LC
242#if @GNULIB_GRANTPT@
243/* Change the ownership and access permission of the slave side of the
244 pseudo-terminal whose master side is specified by FD. */
245# if !@HAVE_GRANTPT@
246_GL_FUNCDECL_SYS (grantpt, int, (int fd));
247# endif
248_GL_CXXALIAS_SYS (grantpt, int, (int fd));
249_GL_CXXALIASWARN (grantpt);
250#elif defined GNULIB_POSIXCHECK
251# undef grantpt
252# if HAVE_RAW_DECL_GRANTPT
253_GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
254 "use gnulib module grantpt for portability");
255# endif
256#endif
257
8912421c 258#if @GNULIB_MALLOC_POSIX@
9157d901 259# if @REPLACE_MALLOC@
f4c79b3c
LC
260# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
261# undef malloc
262# define malloc rpl_malloc
263# endif
264_GL_FUNCDECL_RPL (malloc, void *, (size_t size));
265_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
266# else
267_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
8912421c 268# endif
f4c79b3c 269_GL_CXXALIASWARN (malloc);
8912421c
LC
270#elif defined GNULIB_POSIXCHECK
271# undef malloc
61cd9dc9
LC
272/* Assume malloc is always declared. */
273_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
274 "use gnulib module malloc-posix for portability");
8912421c 275#endif
f240aacb
LC
276
277#if @GNULIB_MKDTEMP@
f240aacb
LC
278/* Create a unique temporary directory from TEMPLATE.
279 The last six characters of TEMPLATE must be "XXXXXX";
280 they are replaced with a string that makes the directory name unique.
281 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
282 The directory is created mode 700. */
f4c79b3c
LC
283# if !@HAVE_MKDTEMP@
284_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
f240aacb 285# endif
f4c79b3c
LC
286_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
287_GL_CXXALIASWARN (mkdtemp);
f240aacb
LC
288#elif defined GNULIB_POSIXCHECK
289# undef mkdtemp
61cd9dc9
LC
290# if HAVE_RAW_DECL_MKDTEMP
291_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
292 "use gnulib module mkdtemp for portability");
293# endif
f240aacb
LC
294#endif
295
8912421c 296#if @GNULIB_MKOSTEMP@
8912421c
LC
297/* Create a unique temporary file from TEMPLATE.
298 The last six characters of TEMPLATE must be "XXXXXX";
299 they are replaced with a string that makes the file name unique.
300 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
301 and O_TEXT, O_BINARY (defined in "binary-io.h").
302 The file is then created, with the specified flags, ensuring it didn't exist
303 before.
304 The file is created read-write (mask at least 0600 & ~umask), but it may be
305 world-readable and world-writable (mask 0666 & ~umask), depending on the
306 implementation.
307 Returns the open file descriptor if successful, otherwise -1 and errno
308 set. */
f4c79b3c
LC
309# if !@HAVE_MKOSTEMP@
310_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
311 _GL_ARG_NONNULL ((1)));
8912421c 312# endif
f4c79b3c
LC
313_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
314_GL_CXXALIASWARN (mkostemp);
8912421c
LC
315#elif defined GNULIB_POSIXCHECK
316# undef mkostemp
61cd9dc9
LC
317# if HAVE_RAW_DECL_MKOSTEMP
318_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
319 "use gnulib module mkostemp for portability");
320# endif
8912421c 321#endif
f240aacb 322
f29ded4b 323#if @GNULIB_MKOSTEMPS@
f29ded4b
LC
324/* Create a unique temporary file from TEMPLATE.
325 The last six characters of TEMPLATE before a suffix of length
326 SUFFIXLEN must be "XXXXXX";
327 they are replaced with a string that makes the file name unique.
328 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
329 and O_TEXT, O_BINARY (defined in "binary-io.h").
330 The file is then created, with the specified flags, ensuring it didn't exist
331 before.
332 The file is created read-write (mask at least 0600 & ~umask), but it may be
333 world-readable and world-writable (mask 0666 & ~umask), depending on the
334 implementation.
335 Returns the open file descriptor if successful, otherwise -1 and errno
336 set. */
f4c79b3c
LC
337# if !@HAVE_MKOSTEMPS@
338_GL_FUNCDECL_SYS (mkostemps, int,
339 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
340 _GL_ARG_NONNULL ((1)));
f29ded4b 341# endif
f4c79b3c
LC
342_GL_CXXALIAS_SYS (mkostemps, int,
343 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
344_GL_CXXALIASWARN (mkostemps);
f29ded4b
LC
345#elif defined GNULIB_POSIXCHECK
346# undef mkostemps
61cd9dc9
LC
347# if HAVE_RAW_DECL_MKOSTEMPS
348_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
349 "use gnulib module mkostemps for portability");
350# endif
f29ded4b
LC
351#endif
352
f240aacb 353#if @GNULIB_MKSTEMP@
f240aacb
LC
354/* Create a unique temporary file from TEMPLATE.
355 The last six characters of TEMPLATE must be "XXXXXX";
356 they are replaced with a string that makes the file name unique.
357 The file is then created, ensuring it didn't exist before.
358 The file is created read-write (mask at least 0600 & ~umask), but it may be
359 world-readable and world-writable (mask 0666 & ~umask), depending on the
360 implementation.
361 Returns the open file descriptor if successful, otherwise -1 and errno
362 set. */
f4c79b3c
LC
363# if @REPLACE_MKSTEMP@
364# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
365# define mkstemp rpl_mkstemp
366# endif
367_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
368_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
369# else
a927b6c1
LC
370# if ! @HAVE_MKSTEMP@
371_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
372# endif
f4c79b3c 373_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
f240aacb 374# endif
f4c79b3c 375_GL_CXXALIASWARN (mkstemp);
f240aacb
LC
376#elif defined GNULIB_POSIXCHECK
377# undef mkstemp
61cd9dc9
LC
378# if HAVE_RAW_DECL_MKSTEMP
379_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
380 "use gnulib module mkstemp for portability");
381# endif
f240aacb
LC
382#endif
383
f29ded4b 384#if @GNULIB_MKSTEMPS@
f29ded4b
LC
385/* Create a unique temporary file from TEMPLATE.
386 The last six characters of TEMPLATE prior to a suffix of length
387 SUFFIXLEN must be "XXXXXX";
388 they are replaced with a string that makes the file name unique.
389 The file is then created, ensuring it didn't exist before.
390 The file is created read-write (mask at least 0600 & ~umask), but it may be
391 world-readable and world-writable (mask 0666 & ~umask), depending on the
392 implementation.
393 Returns the open file descriptor if successful, otherwise -1 and errno
394 set. */
f4c79b3c
LC
395# if !@HAVE_MKSTEMPS@
396_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
397 _GL_ARG_NONNULL ((1)));
f29ded4b 398# endif
f4c79b3c
LC
399_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
400_GL_CXXALIASWARN (mkstemps);
f29ded4b
LC
401#elif defined GNULIB_POSIXCHECK
402# undef mkstemps
61cd9dc9
LC
403# if HAVE_RAW_DECL_MKSTEMPS
404_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
405 "use gnulib module mkstemps for portability");
406# endif
f29ded4b
LC
407#endif
408
a927b6c1
LC
409#if @GNULIB_PTSNAME@
410/* Return the pathname of the pseudo-terminal slave associated with
411 the master FD is open on, or NULL on errors. */
412# if !@HAVE_PTSNAME@
413_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
414# endif
415_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
416_GL_CXXALIASWARN (ptsname);
417#elif defined GNULIB_POSIXCHECK
418# undef ptsname
419# if HAVE_RAW_DECL_PTSNAME
420_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
421 "use gnulib module ptsname for portability");
422# endif
423#endif
424
f240aacb
LC
425#if @GNULIB_PUTENV@
426# if @REPLACE_PUTENV@
f4c79b3c
LC
427# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
428# undef putenv
429# define putenv rpl_putenv
430# endif
431_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
432_GL_CXXALIAS_RPL (putenv, int, (char *string));
433# else
434_GL_CXXALIAS_SYS (putenv, int, (char *string));
f240aacb 435# endif
f4c79b3c 436_GL_CXXALIASWARN (putenv);
f240aacb
LC
437#endif
438
f4c79b3c 439
f240aacb
LC
440#if @GNULIB_RANDOM_R@
441# if !@HAVE_RANDOM_R@
f240aacb
LC
442# ifndef RAND_MAX
443# define RAND_MAX 2147483647
444# endif
f4c79b3c
LC
445# endif
446#endif
f240aacb 447
f4c79b3c
LC
448#if @GNULIB_RANDOM_R@
449# if !@HAVE_RANDOM_R@
450_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
451 _GL_ARG_NONNULL ((1, 2)));
f240aacb 452# endif
f4c79b3c
LC
453_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
454_GL_CXXALIASWARN (random_r);
f240aacb
LC
455#elif defined GNULIB_POSIXCHECK
456# undef random_r
61cd9dc9
LC
457# if HAVE_RAW_DECL_RANDOM_R
458_GL_WARN_ON_USE (random_r, "random_r is unportable - "
459 "use gnulib module random_r for portability");
460# endif
f4c79b3c
LC
461#endif
462
463#if @GNULIB_RANDOM_R@
464# if !@HAVE_RANDOM_R@
465_GL_FUNCDECL_SYS (srandom_r, int,
466 (unsigned int seed, struct random_data *rand_state)
467 _GL_ARG_NONNULL ((2)));
61cd9dc9 468# endif
f4c79b3c
LC
469_GL_CXXALIAS_SYS (srandom_r, int,
470 (unsigned int seed, struct random_data *rand_state));
471_GL_CXXALIASWARN (srandom_r);
472#elif defined GNULIB_POSIXCHECK
f240aacb 473# undef srandom_r
61cd9dc9
LC
474# if HAVE_RAW_DECL_SRANDOM_R
475_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
476 "use gnulib module random_r for portability");
477# endif
f4c79b3c
LC
478#endif
479
480#if @GNULIB_RANDOM_R@
481# if !@HAVE_RANDOM_R@
482_GL_FUNCDECL_SYS (initstate_r, int,
483 (unsigned int seed, char *buf, size_t buf_size,
484 struct random_data *rand_state)
485 _GL_ARG_NONNULL ((2, 4)));
486# endif
487_GL_CXXALIAS_SYS (initstate_r, int,
488 (unsigned int seed, char *buf, size_t buf_size,
489 struct random_data *rand_state));
490_GL_CXXALIASWARN (initstate_r);
491#elif defined GNULIB_POSIXCHECK
492# undef initstate_r
493# if HAVE_RAW_DECL_INITSTATE_R
494_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
495 "use gnulib module random_r for portability");
496# endif
497#endif
498
499#if @GNULIB_RANDOM_R@
500# if !@HAVE_RANDOM_R@
501_GL_FUNCDECL_SYS (setstate_r, int,
502 (char *arg_state, struct random_data *rand_state)
503 _GL_ARG_NONNULL ((1, 2)));
504# endif
505_GL_CXXALIAS_SYS (setstate_r, int,
506 (char *arg_state, struct random_data *rand_state));
507_GL_CXXALIASWARN (setstate_r);
508#elif defined GNULIB_POSIXCHECK
f240aacb 509# undef setstate_r
61cd9dc9
LC
510# if HAVE_RAW_DECL_SETSTATE_R
511_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
512 "use gnulib module random_r for portability");
513# endif
f240aacb
LC
514#endif
515
f4c79b3c 516
8912421c 517#if @GNULIB_REALLOC_POSIX@
9157d901 518# if @REPLACE_REALLOC@
f4c79b3c
LC
519# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
520# undef realloc
521# define realloc rpl_realloc
522# endif
523_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
524_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
525# else
526_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
8912421c 527# endif
f4c79b3c 528_GL_CXXALIASWARN (realloc);
8912421c
LC
529#elif defined GNULIB_POSIXCHECK
530# undef realloc
61cd9dc9
LC
531/* Assume realloc is always declared. */
532_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
533 "use gnulib module realloc-posix for portability");
8912421c
LC
534#endif
535
536#if @GNULIB_REALPATH@
537# if @REPLACE_REALPATH@
f4c79b3c
LC
538# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
539# define realpath rpl_realpath
540# endif
541_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
542 _GL_ARG_NONNULL ((1)));
543_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
544# else
545# if !@HAVE_REALPATH@
546_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
547 _GL_ARG_NONNULL ((1)));
548# endif
549_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
8912421c 550# endif
f4c79b3c 551_GL_CXXALIASWARN (realpath);
8912421c
LC
552#elif defined GNULIB_POSIXCHECK
553# undef realpath
61cd9dc9
LC
554# if HAVE_RAW_DECL_REALPATH
555_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
556 "canonicalize or canonicalize-lgpl for portability");
557# endif
8912421c 558#endif
f240aacb
LC
559
560#if @GNULIB_RPMATCH@
f240aacb
LC
561/* Test a user response to a question.
562 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
f4c79b3c
LC
563# if !@HAVE_RPMATCH@
564_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
f240aacb 565# endif
f4c79b3c
LC
566_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
567_GL_CXXALIASWARN (rpmatch);
f240aacb
LC
568#elif defined GNULIB_POSIXCHECK
569# undef rpmatch
61cd9dc9
LC
570# if HAVE_RAW_DECL_RPMATCH
571_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
572 "use gnulib module rpmatch for portability");
573# endif
f240aacb
LC
574#endif
575
f240aacb 576#if @GNULIB_SETENV@
f240aacb
LC
577/* Set NAME to VALUE in the environment.
578 If REPLACE is nonzero, overwrite an existing value. */
f4c79b3c
LC
579# if @REPLACE_SETENV@
580# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
581# undef setenv
582# define setenv rpl_setenv
583# endif
584_GL_FUNCDECL_RPL (setenv, int,
585 (const char *name, const char *value, int replace)
586 _GL_ARG_NONNULL ((1)));
587_GL_CXXALIAS_RPL (setenv, int,
588 (const char *name, const char *value, int replace));
589# else
ab4d62ad 590# if !@HAVE_DECL_SETENV@
f4c79b3c
LC
591_GL_FUNCDECL_SYS (setenv, int,
592 (const char *name, const char *value, int replace)
593 _GL_ARG_NONNULL ((1)));
594# endif
595_GL_CXXALIAS_SYS (setenv, int,
596 (const char *name, const char *value, int replace));
f240aacb 597# endif
ab4d62ad 598# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
f4c79b3c 599_GL_CXXALIASWARN (setenv);
ab4d62ad 600# endif
4f02b98d
LC
601#elif defined GNULIB_POSIXCHECK
602# undef setenv
61cd9dc9
LC
603# if HAVE_RAW_DECL_SETENV
604_GL_WARN_ON_USE (setenv, "setenv is unportable - "
605 "use gnulib module setenv for portability");
606# endif
f240aacb
LC
607#endif
608
f240aacb 609#if @GNULIB_STRTOD@
f240aacb 610 /* Parse a double from STRING, updating ENDP if appropriate. */
f4c79b3c
LC
611# if @REPLACE_STRTOD@
612# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
613# define strtod rpl_strtod
614# endif
615_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
616 _GL_ARG_NONNULL ((1)));
617_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
618# else
619# if !@HAVE_STRTOD@
620_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
621 _GL_ARG_NONNULL ((1)));
622# endif
623_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
f240aacb 624# endif
f4c79b3c 625_GL_CXXALIASWARN (strtod);
f240aacb
LC
626#elif defined GNULIB_POSIXCHECK
627# undef strtod
61cd9dc9
LC
628# if HAVE_RAW_DECL_STRTOD
629_GL_WARN_ON_USE (strtod, "strtod is unportable - "
630 "use gnulib module strtod for portability");
631# endif
f240aacb
LC
632#endif
633
f240aacb 634#if @GNULIB_STRTOLL@
f240aacb
LC
635/* Parse a signed integer whose textual representation starts at STRING.
636 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
637 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
638 "0x").
639 If ENDPTR is not NULL, the address of the first byte after the integer is
640 stored in *ENDPTR.
641 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
642 to ERANGE. */
f4c79b3c
LC
643# if !@HAVE_STRTOLL@
644_GL_FUNCDECL_SYS (strtoll, long long,
645 (const char *string, char **endptr, int base)
646 _GL_ARG_NONNULL ((1)));
f240aacb 647# endif
f4c79b3c
LC
648_GL_CXXALIAS_SYS (strtoll, long long,
649 (const char *string, char **endptr, int base));
650_GL_CXXALIASWARN (strtoll);
f240aacb
LC
651#elif defined GNULIB_POSIXCHECK
652# undef strtoll
61cd9dc9
LC
653# if HAVE_RAW_DECL_STRTOLL
654_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
655 "use gnulib module strtoll for portability");
656# endif
f240aacb
LC
657#endif
658
f240aacb 659#if @GNULIB_STRTOULL@
f240aacb
LC
660/* Parse an unsigned integer whose textual representation starts at STRING.
661 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
662 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
663 "0x").
664 If ENDPTR is not NULL, the address of the first byte after the integer is
665 stored in *ENDPTR.
666 Upon overflow, the return value is ULLONG_MAX, and errno is set to
667 ERANGE. */
f4c79b3c
LC
668# if !@HAVE_STRTOULL@
669_GL_FUNCDECL_SYS (strtoull, unsigned long long,
670 (const char *string, char **endptr, int base)
671 _GL_ARG_NONNULL ((1)));
f240aacb 672# endif
f4c79b3c
LC
673_GL_CXXALIAS_SYS (strtoull, unsigned long long,
674 (const char *string, char **endptr, int base));
675_GL_CXXALIASWARN (strtoull);
f240aacb
LC
676#elif defined GNULIB_POSIXCHECK
677# undef strtoull
61cd9dc9
LC
678# if HAVE_RAW_DECL_STRTOULL
679_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
680 "use gnulib module strtoull for portability");
681# endif
f240aacb
LC
682#endif
683
a927b6c1
LC
684#if @GNULIB_UNLOCKPT@
685/* Unlock the slave side of the pseudo-terminal whose master side is specified
686 by FD, so that it can be opened. */
687# if !@HAVE_UNLOCKPT@
688_GL_FUNCDECL_SYS (unlockpt, int, (int fd));
689# endif
690_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
691_GL_CXXALIASWARN (unlockpt);
692#elif defined GNULIB_POSIXCHECK
693# undef unlockpt
694# if HAVE_RAW_DECL_UNLOCKPT
0f00f2c3 695_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
a927b6c1
LC
696 "use gnulib module unlockpt for portability");
697# endif
698#endif
699
8912421c 700#if @GNULIB_UNSETENV@
8912421c 701/* Remove the variable NAME from the environment. */
f4c79b3c
LC
702# if @REPLACE_UNSETENV@
703# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
704# undef unsetenv
705# define unsetenv rpl_unsetenv
706# endif
707_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
708_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
709# else
ab4d62ad 710# if !@HAVE_DECL_UNSETENV@
f4c79b3c
LC
711_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
712# endif
713_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
8912421c 714# endif
ab4d62ad 715# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
f4c79b3c 716_GL_CXXALIASWARN (unsetenv);
ab4d62ad 717# endif
4f02b98d
LC
718#elif defined GNULIB_POSIXCHECK
719# undef unsetenv
61cd9dc9
LC
720# if HAVE_RAW_DECL_UNSETENV
721_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
722 "use gnulib module unsetenv for portability");
723# endif
8912421c 724#endif
f240aacb 725
f240aacb
LC
726
727#endif /* _GL_STDLIB_H */
728#endif /* _GL_STDLIB_H */
729#endif