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