stdlib: don't get in the way of non-GCC __attribute__
[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 #if @GNULIB_RANDOM_R@
53
54 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
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
60
61 # if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@
62 #  include <stdint.h>
63 # endif
64
65 # if !@HAVE_STRUCT_RANDOM_DATA@
66 /* Define 'struct random_data'.
67    But allow multiple gnulib generated <stdlib.h> replacements to coexist.  */
68 #  if !GNULIB_defined_struct_random_data
69 struct random_data
70 {
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.  */
78 };
79 #   define GNULIB_defined_struct_random_data 1
80 #  endif
81 # endif
82 #endif
83
84 #if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
85 /* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
86 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
87 /* But avoid namespace pollution on glibc systems and native Windows.  */
88 # include <unistd.h>
89 #endif
90
91 #if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__
92 # define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
93 #else
94 # define _GL_ATTRIBUTE_NORETURN
95 #endif
96
97 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
98
99 /* The definition of _GL_ARG_NONNULL is copied here.  */
100
101 /* The definition of _GL_WARN_ON_USE is copied here.  */
102
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
118 #if @GNULIB__EXIT@
119 /* Terminate the current process with the given return code, without running
120    the 'atexit' handlers.  */
121 # if !@HAVE__EXIT@
122 _GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN);
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
135 #if @GNULIB_ATOLL@
136 /* Parse a signed decimal integer.
137    Returns the value of the integer.  Errors are not detected.  */
138 # if !@HAVE_ATOLL@
139 _GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
140 # endif
141 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
142 _GL_CXXALIASWARN (atoll);
143 #elif defined GNULIB_POSIXCHECK
144 # undef atoll
145 # if HAVE_RAW_DECL_ATOLL
146 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
147                  "use gnulib module atoll for portability");
148 # endif
149 #endif
150
151 #if @GNULIB_CALLOC_POSIX@
152 # if @REPLACE_CALLOC@
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));
161 # endif
162 _GL_CXXALIASWARN (calloc);
163 #elif defined GNULIB_POSIXCHECK
164 # undef calloc
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");
168 #endif
169
170 #if @GNULIB_CANONICALIZE_FILE_NAME@
171 # if @REPLACE_CANONICALIZE_FILE_NAME@
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));
184 # endif
185 _GL_CXXALIASWARN (canonicalize_file_name);
186 #elif defined GNULIB_POSIXCHECK
187 # undef canonicalize_file_name
188 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
189 _GL_WARN_ON_USE (canonicalize_file_name,
190                  "canonicalize_file_name is unportable - "
191                  "use gnulib module canonicalize-lgpl for portability");
192 # endif
193 #endif
194
195 #if @GNULIB_GETLOADAVG@
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.  */
200 # if !@HAVE_DECL_GETLOADAVG@
201 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
202                                    _GL_ARG_NONNULL ((1)));
203 # endif
204 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
205 _GL_CXXALIASWARN (getloadavg);
206 #elif defined GNULIB_POSIXCHECK
207 # undef getloadavg
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
212 #endif
213
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@
227 _GL_FUNCDECL_SYS (getsubopt, int,
228                   (char **optionp, char *const *tokens, char **valuep)
229                   _GL_ARG_NONNULL ((1, 2, 3)));
230 # endif
231 _GL_CXXALIAS_SYS (getsubopt, int,
232                   (char **optionp, char *const *tokens, char **valuep));
233 _GL_CXXALIASWARN (getsubopt);
234 #elif defined GNULIB_POSIXCHECK
235 # undef getsubopt
236 # if HAVE_RAW_DECL_GETSUBOPT
237 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
238                  "use gnulib module getsubopt for portability");
239 # endif
240 #endif
241
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
258 #if @GNULIB_MALLOC_POSIX@
259 # if @REPLACE_MALLOC@
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));
268 # endif
269 _GL_CXXALIASWARN (malloc);
270 #elif defined GNULIB_POSIXCHECK
271 # undef malloc
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");
275 #endif
276
277 #if @GNULIB_MKDTEMP@
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.  */
283 # if !@HAVE_MKDTEMP@
284 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
285 # endif
286 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
287 _GL_CXXALIASWARN (mkdtemp);
288 #elif defined GNULIB_POSIXCHECK
289 # undef mkdtemp
290 # if HAVE_RAW_DECL_MKDTEMP
291 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
292                  "use gnulib module mkdtemp for portability");
293 # endif
294 #endif
295
296 #if @GNULIB_MKOSTEMP@
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.  */
309 # if !@HAVE_MKOSTEMP@
310 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
311                                  _GL_ARG_NONNULL ((1)));
312 # endif
313 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
314 _GL_CXXALIASWARN (mkostemp);
315 #elif defined GNULIB_POSIXCHECK
316 # undef mkostemp
317 # if HAVE_RAW_DECL_MKOSTEMP
318 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
319                  "use gnulib module mkostemp for portability");
320 # endif
321 #endif
322
323 #if @GNULIB_MKOSTEMPS@
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.  */
337 # if !@HAVE_MKOSTEMPS@
338 _GL_FUNCDECL_SYS (mkostemps, int,
339                   (char * /*template*/, int /*suffixlen*/, int /*flags*/)
340                   _GL_ARG_NONNULL ((1)));
341 # endif
342 _GL_CXXALIAS_SYS (mkostemps, int,
343                   (char * /*template*/, int /*suffixlen*/, int /*flags*/));
344 _GL_CXXALIASWARN (mkostemps);
345 #elif defined GNULIB_POSIXCHECK
346 # undef mkostemps
347 # if HAVE_RAW_DECL_MKOSTEMPS
348 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
349                  "use gnulib module mkostemps for portability");
350 # endif
351 #endif
352
353 #if @GNULIB_MKSTEMP@
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.  */
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
370 #  if ! @HAVE_MKSTEMP@
371 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
372 #  endif
373 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
374 # endif
375 _GL_CXXALIASWARN (mkstemp);
376 #elif defined GNULIB_POSIXCHECK
377 # undef mkstemp
378 # if HAVE_RAW_DECL_MKSTEMP
379 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
380                  "use gnulib module mkstemp for portability");
381 # endif
382 #endif
383
384 #if @GNULIB_MKSTEMPS@
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.  */
395 # if !@HAVE_MKSTEMPS@
396 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
397                                  _GL_ARG_NONNULL ((1)));
398 # endif
399 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
400 _GL_CXXALIASWARN (mkstemps);
401 #elif defined GNULIB_POSIXCHECK
402 # undef mkstemps
403 # if HAVE_RAW_DECL_MKSTEMPS
404 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
405                  "use gnulib module mkstemps for portability");
406 # endif
407 #endif
408
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
425 #if @GNULIB_PUTENV@
426 # if @REPLACE_PUTENV@
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));
435 # endif
436 _GL_CXXALIASWARN (putenv);
437 #endif
438
439
440 #if @GNULIB_RANDOM_R@
441 # if !@HAVE_RANDOM_R@
442 #  ifndef RAND_MAX
443 #   define RAND_MAX 2147483647
444 #  endif
445 # endif
446 #endif
447
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)));
452 # endif
453 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
454 _GL_CXXALIASWARN (random_r);
455 #elif defined GNULIB_POSIXCHECK
456 # undef random_r
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
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)));
468 # endif
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
473 # undef srandom_r
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
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
509 # undef setstate_r
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
514 #endif
515
516
517 #if @GNULIB_REALLOC_POSIX@
518 # if @REPLACE_REALLOC@
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));
527 # endif
528 _GL_CXXALIASWARN (realloc);
529 #elif defined GNULIB_POSIXCHECK
530 # undef realloc
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");
534 #endif
535
536 #if @GNULIB_REALPATH@
537 # if @REPLACE_REALPATH@
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));
550 # endif
551 _GL_CXXALIASWARN (realpath);
552 #elif defined GNULIB_POSIXCHECK
553 # undef realpath
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
558 #endif
559
560 #if @GNULIB_RPMATCH@
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.  */
563 # if !@HAVE_RPMATCH@
564 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
565 # endif
566 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
567 _GL_CXXALIASWARN (rpmatch);
568 #elif defined GNULIB_POSIXCHECK
569 # undef rpmatch
570 # if HAVE_RAW_DECL_RPMATCH
571 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
572                  "use gnulib module rpmatch for portability");
573 # endif
574 #endif
575
576 #if @GNULIB_SETENV@
577 /* Set NAME to VALUE in the environment.
578    If REPLACE is nonzero, overwrite an existing value.  */
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
590 #  if !@HAVE_DECL_SETENV@
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));
597 # endif
598 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
599 _GL_CXXALIASWARN (setenv);
600 # endif
601 #elif defined GNULIB_POSIXCHECK
602 # undef setenv
603 # if HAVE_RAW_DECL_SETENV
604 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
605                  "use gnulib module setenv for portability");
606 # endif
607 #endif
608
609 #if @GNULIB_STRTOD@
610  /* Parse a double from STRING, updating ENDP if appropriate.  */
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));
624 # endif
625 _GL_CXXALIASWARN (strtod);
626 #elif defined GNULIB_POSIXCHECK
627 # undef strtod
628 # if HAVE_RAW_DECL_STRTOD
629 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
630                  "use gnulib module strtod for portability");
631 # endif
632 #endif
633
634 #if @GNULIB_STRTOLL@
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.  */
643 # if !@HAVE_STRTOLL@
644 _GL_FUNCDECL_SYS (strtoll, long long,
645                   (const char *string, char **endptr, int base)
646                   _GL_ARG_NONNULL ((1)));
647 # endif
648 _GL_CXXALIAS_SYS (strtoll, long long,
649                   (const char *string, char **endptr, int base));
650 _GL_CXXALIASWARN (strtoll);
651 #elif defined GNULIB_POSIXCHECK
652 # undef strtoll
653 # if HAVE_RAW_DECL_STRTOLL
654 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
655                  "use gnulib module strtoll for portability");
656 # endif
657 #endif
658
659 #if @GNULIB_STRTOULL@
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.  */
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)));
672 # endif
673 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
674                   (const char *string, char **endptr, int base));
675 _GL_CXXALIASWARN (strtoull);
676 #elif defined GNULIB_POSIXCHECK
677 # undef strtoull
678 # if HAVE_RAW_DECL_STRTOULL
679 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
680                  "use gnulib module strtoull for portability");
681 # endif
682 #endif
683
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
695 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
696                  "use gnulib module unlockpt for portability");
697 # endif
698 #endif
699
700 #if @GNULIB_UNSETENV@
701 /* Remove the variable NAME from the environment.  */
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
710 #  if !@HAVE_DECL_UNSETENV@
711 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
712 #  endif
713 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
714 # endif
715 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
716 _GL_CXXALIASWARN (unsetenv);
717 # endif
718 #elif defined GNULIB_POSIXCHECK
719 # undef unsetenv
720 # if HAVE_RAW_DECL_UNSETENV
721 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
722                  "use gnulib module unsetenv for portability");
723 # endif
724 #endif
725
726
727 #endif /* _GL_STDLIB_H */
728 #endif /* _GL_STDLIB_H */
729 #endif