summaryrefslogtreecommitdiffstats
path: root/gl/stdlib.in.h
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 23:27:12 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 23:27:12 +0200
commit26fbe7f1e68bb0c96da32491efcf3696fe6c299b (patch)
treec4d95289187a64e9c7517bf73d8208026c3d2fb3 /gl/stdlib.in.h
parent5f79e3e9f62ca5487d9881973149136ba1d19d3e (diff)
downloadmonitoring-plugins-26fbe7f1e68bb0c96da32491efcf3696fe6c299b.tar.gz
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/stdlib.in.h')
-rw-r--r--gl/stdlib.in.h332
1 files changed, 288 insertions, 44 deletions
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index d4ac4690..c9552480 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <stdlib.h>. 1/* A GNU-like <stdlib.h>.
2 2
3 Copyright (C) 1995, 2001-2004, 2006-2010 Free Software Foundation, Inc. 3 Copyright (C) 1995, 2001-2004, 2006-2013 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -18,43 +18,60 @@
18#if __GNUC__ >= 3 18#if __GNUC__ >= 3
19@PRAGMA_SYSTEM_HEADER@ 19@PRAGMA_SYSTEM_HEADER@
20#endif 20#endif
21@PRAGMA_COLUMNS@
21 22
22#if defined __need_malloc_and_calloc 23#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
23/* Special invocation convention inside glibc header files. */ 24/* Special invocation conventions inside some gnulib header files,
25 and inside some glibc header files, respectively. */
24 26
25#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ 27#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
26 28
27#else 29#else
28/* Normal invocation convention. */ 30/* Normal invocation convention. */
29 31
30#ifndef _GL_STDLIB_H 32#ifndef _@GUARD_PREFIX@_STDLIB_H
31 33
32/* The include_next requires a split double-inclusion guard. */ 34/* The include_next requires a split double-inclusion guard. */
33#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ 35#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
34 36
35#ifndef _GL_STDLIB_H 37#ifndef _@GUARD_PREFIX@_STDLIB_H
36#define _GL_STDLIB_H 38#define _@GUARD_PREFIX@_STDLIB_H
37 39
38/* NetBSD 5.0 mis-defines NULL. */ 40/* NetBSD 5.0 mis-defines NULL. */
39#include <stddef.h> 41#include <stddef.h>
40 42
43/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
44#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
45# include <sys/wait.h>
46#endif
47
41/* Solaris declares getloadavg() in <sys/loadavg.h>. */ 48/* Solaris declares getloadavg() in <sys/loadavg.h>. */
42#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ 49#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
43# include <sys/loadavg.h> 50# include <sys/loadavg.h>
44#endif 51#endif
45 52
46/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included 53/* Native Windows platforms declare mktemp() in <io.h>. */
47 from <stdlib.h> if _REENTRANT is defined. Include it always. */ 54#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
48#if @HAVE_RANDOM_H@ 55# include <io.h>
49# include <random.h>
50#endif 56#endif
51 57
52#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \ 58#if @GNULIB_RANDOM_R@
53 || defined GNULIB_POSIXCHECK 59
54# include <stdint.h> 60/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
55#endif 61 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
62 'struct random_data'. */
63# if @HAVE_RANDOM_H@
64# include <random.h>
65# endif
56 66
57#if !@HAVE_STRUCT_RANDOM_DATA@ 67# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
68# include <stdint.h>
69# endif
70
71# if !@HAVE_STRUCT_RANDOM_DATA@
72/* Define 'struct random_data'.
73 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
74# if !GNULIB_defined_struct_random_data
58struct random_data 75struct random_data
59{ 76{
60 int32_t *fptr; /* Front pointer. */ 77 int32_t *fptr; /* Front pointer. */
@@ -65,21 +82,29 @@ struct random_data
65 int rand_sep; /* Distance between front and rear. */ 82 int rand_sep; /* Distance between front and rear. */
66 int32_t *end_ptr; /* Pointer behind state table. */ 83 int32_t *end_ptr; /* Pointer behind state table. */
67}; 84};
85# define GNULIB_defined_struct_random_data 1
86# endif
87# endif
68#endif 88#endif
69 89
70#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 90#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
71/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ 91/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
92/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
72/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ 93/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
73/* But avoid namespace pollution on glibc systems and native Windows. */ 94/* But avoid namespace pollution on glibc systems and native Windows. */
74# include <unistd.h> 95# include <unistd.h>
75#endif 96#endif
76 97
77#ifndef __attribute__ 98/* The __attribute__ feature is available in gcc versions 2.5 and later.
78# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) 99 The attribute __pure__ was added in gcc 2.96. */
79# define __attribute__(Spec) /* empty */ 100#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
80# endif 101# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
102#else
103# define _GL_ATTRIBUTE_PURE /* empty */
81#endif 104#endif
82 105
106/* The definition of _Noreturn is copied here. */
107
83/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 108/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
84 109
85/* The definition of _GL_ARG_NONNULL is copied here. */ 110/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -105,7 +130,7 @@ struct random_data
105/* Terminate the current process with the given return code, without running 130/* Terminate the current process with the given return code, without running
106 the 'atexit' handlers. */ 131 the 'atexit' handlers. */
107# if !@HAVE__EXIT@ 132# if !@HAVE__EXIT@
108_GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__))); 133_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
109# endif 134# endif
110_GL_CXXALIAS_SYS (_Exit, void, (int status)); 135_GL_CXXALIAS_SYS (_Exit, void, (int status));
111_GL_CXXALIASWARN (_Exit); 136_GL_CXXALIASWARN (_Exit);
@@ -122,7 +147,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
122/* Parse a signed decimal integer. 147/* Parse a signed decimal integer.
123 Returns the value of the integer. Errors are not detected. */ 148 Returns the value of the integer. Errors are not detected. */
124# if !@HAVE_ATOLL@ 149# if !@HAVE_ATOLL@
125_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1))); 150_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
151 _GL_ATTRIBUTE_PURE
152 _GL_ARG_NONNULL ((1)));
126# endif 153# endif
127_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 154_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
128_GL_CXXALIASWARN (atoll); 155_GL_CXXALIASWARN (atoll);
@@ -172,7 +199,8 @@ _GL_CXXALIASWARN (canonicalize_file_name);
172#elif defined GNULIB_POSIXCHECK 199#elif defined GNULIB_POSIXCHECK
173# undef canonicalize_file_name 200# undef canonicalize_file_name
174# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 201# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
175_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - " 202_GL_WARN_ON_USE (canonicalize_file_name,
203 "canonicalize_file_name is unportable - "
176 "use gnulib module canonicalize-lgpl for portability"); 204 "use gnulib module canonicalize-lgpl for portability");
177# endif 205# endif
178#endif 206#endif
@@ -235,14 +263,19 @@ _GL_CXXALIASWARN (grantpt);
235#elif defined GNULIB_POSIXCHECK 263#elif defined GNULIB_POSIXCHECK
236# undef grantpt 264# undef grantpt
237# if HAVE_RAW_DECL_GRANTPT 265# if HAVE_RAW_DECL_GRANTPT
238_GL_WARN_ON_USE (ptsname, "grantpt is not portable - " 266_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
239 "use gnulib module grantpt for portability"); 267 "use gnulib module grantpt for portability");
240# endif 268# endif
241#endif 269#endif
242 270
271/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
272 rely on GNU or POSIX semantics for malloc and realloc (for example,
273 by never specifying a zero size), so it does not need malloc or
274 realloc to be redefined. */
243#if @GNULIB_MALLOC_POSIX@ 275#if @GNULIB_MALLOC_POSIX@
244# if @REPLACE_MALLOC@ 276# if @REPLACE_MALLOC@
245# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 277# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
278 || _GL_USE_STDLIB_ALLOC)
246# undef malloc 279# undef malloc
247# define malloc rpl_malloc 280# define malloc rpl_malloc
248# endif 281# endif
@@ -252,13 +285,28 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
252_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 285_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
253# endif 286# endif
254_GL_CXXALIASWARN (malloc); 287_GL_CXXALIASWARN (malloc);
255#elif defined GNULIB_POSIXCHECK 288#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
256# undef malloc 289# undef malloc
257/* Assume malloc is always declared. */ 290/* Assume malloc is always declared. */
258_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " 291_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
259 "use gnulib module malloc-posix for portability"); 292 "use gnulib module malloc-posix for portability");
260#endif 293#endif
261 294
295/* Convert a multibyte character to a wide character. */
296#if @GNULIB_MBTOWC@
297# if @REPLACE_MBTOWC@
298# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
299# undef mbtowc
300# define mbtowc rpl_mbtowc
301# endif
302_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
303_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
304# else
305_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
306# endif
307_GL_CXXALIASWARN (mbtowc);
308#endif
309
262#if @GNULIB_MKDTEMP@ 310#if @GNULIB_MKDTEMP@
263/* Create a unique temporary directory from TEMPLATE. 311/* Create a unique temporary directory from TEMPLATE.
264 The last six characters of TEMPLATE must be "XXXXXX"; 312 The last six characters of TEMPLATE must be "XXXXXX";
@@ -391,13 +439,38 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
391# endif 439# endif
392#endif 440#endif
393 441
442#if @GNULIB_POSIX_OPENPT@
443/* Return an FD open to the master side of a pseudo-terminal. Flags should
444 include O_RDWR, and may also include O_NOCTTY. */
445# if !@HAVE_POSIX_OPENPT@
446_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
447# endif
448_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
449_GL_CXXALIASWARN (posix_openpt);
450#elif defined GNULIB_POSIXCHECK
451# undef posix_openpt
452# if HAVE_RAW_DECL_POSIX_OPENPT
453_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
454 "use gnulib module posix_openpt for portability");
455# endif
456#endif
457
394#if @GNULIB_PTSNAME@ 458#if @GNULIB_PTSNAME@
395/* Return the pathname of the pseudo-terminal slave associated with 459/* Return the pathname of the pseudo-terminal slave associated with
396 the master FD is open on, or NULL on errors. */ 460 the master FD is open on, or NULL on errors. */
397# if !@HAVE_PTSNAME@ 461# if @REPLACE_PTSNAME@
462# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
463# undef ptsname
464# define ptsname rpl_ptsname
465# endif
466_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
467_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
468# else
469# if !@HAVE_PTSNAME@
398_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 470_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
399# endif 471# endif
400_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 472_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
473# endif
401_GL_CXXALIASWARN (ptsname); 474_GL_CXXALIASWARN (ptsname);
402#elif defined GNULIB_POSIXCHECK 475#elif defined GNULIB_POSIXCHECK
403# undef ptsname 476# undef ptsname
@@ -407,6 +480,32 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
407# endif 480# endif
408#endif 481#endif
409 482
483#if @GNULIB_PTSNAME_R@
484/* Set the pathname of the pseudo-terminal slave associated with
485 the master FD is open on and return 0, or set errno and return
486 non-zero on errors. */
487# if @REPLACE_PTSNAME_R@
488# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
489# undef ptsname_r
490# define ptsname_r rpl_ptsname_r
491# endif
492_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
493_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
494# else
495# if !@HAVE_PTSNAME_R@
496_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
497# endif
498_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
499# endif
500_GL_CXXALIASWARN (ptsname_r);
501#elif defined GNULIB_POSIXCHECK
502# undef ptsname_r
503# if HAVE_RAW_DECL_PTSNAME_R
504_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
505 "use gnulib module ptsname_r for portability");
506# endif
507#endif
508
410#if @GNULIB_PUTENV@ 509#if @GNULIB_PUTENV@
411# if @REPLACE_PUTENV@ 510# if @REPLACE_PUTENV@
412# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 511# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -430,12 +529,83 @@ _GL_CXXALIASWARN (putenv);
430# endif 529# endif
431#endif 530#endif
432 531
532
533#if @GNULIB_RANDOM@
534# if !@HAVE_RANDOM@
535_GL_FUNCDECL_SYS (random, long, (void));
536# endif
537_GL_CXXALIAS_SYS (random, long, (void));
538_GL_CXXALIASWARN (random);
539#elif defined GNULIB_POSIXCHECK
540# undef random
541# if HAVE_RAW_DECL_RANDOM
542_GL_WARN_ON_USE (random, "random is unportable - "
543 "use gnulib module random for portability");
544# endif
545#endif
546
547#if @GNULIB_RANDOM@
548# if !@HAVE_RANDOM@
549_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
550# endif
551_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
552_GL_CXXALIASWARN (srandom);
553#elif defined GNULIB_POSIXCHECK
554# undef srandom
555# if HAVE_RAW_DECL_SRANDOM
556_GL_WARN_ON_USE (srandom, "srandom is unportable - "
557 "use gnulib module random for portability");
558# endif
559#endif
560
561#if @GNULIB_RANDOM@
562# if !@HAVE_RANDOM@
563_GL_FUNCDECL_SYS (initstate, char *,
564 (unsigned int seed, char *buf, size_t buf_size)
565 _GL_ARG_NONNULL ((2)));
566# endif
567_GL_CXXALIAS_SYS (initstate, char *,
568 (unsigned int seed, char *buf, size_t buf_size));
569_GL_CXXALIASWARN (initstate);
570#elif defined GNULIB_POSIXCHECK
571# undef initstate
572# if HAVE_RAW_DECL_INITSTATE_R
573_GL_WARN_ON_USE (initstate, "initstate is unportable - "
574 "use gnulib module random for portability");
575# endif
576#endif
577
578#if @GNULIB_RANDOM@
579# if !@HAVE_RANDOM@
580_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
581# endif
582_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
583_GL_CXXALIASWARN (setstate);
584#elif defined GNULIB_POSIXCHECK
585# undef setstate
586# if HAVE_RAW_DECL_SETSTATE_R
587_GL_WARN_ON_USE (setstate, "setstate is unportable - "
588 "use gnulib module random for portability");
589# endif
590#endif
591
592
433#if @GNULIB_RANDOM_R@ 593#if @GNULIB_RANDOM_R@
434# if !@HAVE_RANDOM_R@ 594# if @REPLACE_RANDOM_R@
595# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
596# undef random_r
597# define random_r rpl_random_r
598# endif
599_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
600 _GL_ARG_NONNULL ((1, 2)));
601_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
602# else
603# if !@HAVE_RANDOM_R@
435_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 604_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
436 _GL_ARG_NONNULL ((1, 2))); 605 _GL_ARG_NONNULL ((1, 2)));
437# endif 606# endif
438_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 607_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
608# endif
439_GL_CXXALIASWARN (random_r); 609_GL_CXXALIASWARN (random_r);
440#elif defined GNULIB_POSIXCHECK 610#elif defined GNULIB_POSIXCHECK
441# undef random_r 611# undef random_r
@@ -446,13 +616,25 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - "
446#endif 616#endif
447 617
448#if @GNULIB_RANDOM_R@ 618#if @GNULIB_RANDOM_R@
449# if !@HAVE_RANDOM_R@ 619# if @REPLACE_RANDOM_R@
620# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
621# undef srandom_r
622# define srandom_r rpl_srandom_r
623# endif
624_GL_FUNCDECL_RPL (srandom_r, int,
625 (unsigned int seed, struct random_data *rand_state)
626 _GL_ARG_NONNULL ((2)));
627_GL_CXXALIAS_RPL (srandom_r, int,
628 (unsigned int seed, struct random_data *rand_state));
629# else
630# if !@HAVE_RANDOM_R@
450_GL_FUNCDECL_SYS (srandom_r, int, 631_GL_FUNCDECL_SYS (srandom_r, int,
451 (unsigned int seed, struct random_data *rand_state) 632 (unsigned int seed, struct random_data *rand_state)
452 _GL_ARG_NONNULL ((2))); 633 _GL_ARG_NONNULL ((2)));
453# endif 634# endif
454_GL_CXXALIAS_SYS (srandom_r, int, 635_GL_CXXALIAS_SYS (srandom_r, int,
455 (unsigned int seed, struct random_data *rand_state)); 636 (unsigned int seed, struct random_data *rand_state));
637# endif
456_GL_CXXALIASWARN (srandom_r); 638_GL_CXXALIASWARN (srandom_r);
457#elif defined GNULIB_POSIXCHECK 639#elif defined GNULIB_POSIXCHECK
458# undef srandom_r 640# undef srandom_r
@@ -463,15 +645,29 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
463#endif 645#endif
464 646
465#if @GNULIB_RANDOM_R@ 647#if @GNULIB_RANDOM_R@
466# if !@HAVE_RANDOM_R@ 648# if @REPLACE_RANDOM_R@
649# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
650# undef initstate_r
651# define initstate_r rpl_initstate_r
652# endif
653_GL_FUNCDECL_RPL (initstate_r, int,
654 (unsigned int seed, char *buf, size_t buf_size,
655 struct random_data *rand_state)
656 _GL_ARG_NONNULL ((2, 4)));
657_GL_CXXALIAS_RPL (initstate_r, int,
658 (unsigned int seed, char *buf, size_t buf_size,
659 struct random_data *rand_state));
660# else
661# if !@HAVE_RANDOM_R@
467_GL_FUNCDECL_SYS (initstate_r, int, 662_GL_FUNCDECL_SYS (initstate_r, int,
468 (unsigned int seed, char *buf, size_t buf_size, 663 (unsigned int seed, char *buf, size_t buf_size,
469 struct random_data *rand_state) 664 struct random_data *rand_state)
470 _GL_ARG_NONNULL ((2, 4))); 665 _GL_ARG_NONNULL ((2, 4)));
471# endif 666# endif
472_GL_CXXALIAS_SYS (initstate_r, int, 667_GL_CXXALIAS_SYS (initstate_r, int,
473 (unsigned int seed, char *buf, size_t buf_size, 668 (unsigned int seed, char *buf, size_t buf_size,
474 struct random_data *rand_state)); 669 struct random_data *rand_state));
670# endif
475_GL_CXXALIASWARN (initstate_r); 671_GL_CXXALIASWARN (initstate_r);
476#elif defined GNULIB_POSIXCHECK 672#elif defined GNULIB_POSIXCHECK
477# undef initstate_r 673# undef initstate_r
@@ -482,13 +678,25 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
482#endif 678#endif
483 679
484#if @GNULIB_RANDOM_R@ 680#if @GNULIB_RANDOM_R@
485# if !@HAVE_RANDOM_R@ 681# if @REPLACE_RANDOM_R@
682# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
683# undef setstate_r
684# define setstate_r rpl_setstate_r
685# endif
686_GL_FUNCDECL_RPL (setstate_r, int,
687 (char *arg_state, struct random_data *rand_state)
688 _GL_ARG_NONNULL ((1, 2)));
689_GL_CXXALIAS_RPL (setstate_r, int,
690 (char *arg_state, struct random_data *rand_state));
691# else
692# if !@HAVE_RANDOM_R@
486_GL_FUNCDECL_SYS (setstate_r, int, 693_GL_FUNCDECL_SYS (setstate_r, int,
487 (char *arg_state, struct random_data *rand_state) 694 (char *arg_state, struct random_data *rand_state)
488 _GL_ARG_NONNULL ((1, 2))); 695 _GL_ARG_NONNULL ((1, 2)));
489# endif 696# endif
490_GL_CXXALIAS_SYS (setstate_r, int, 697_GL_CXXALIAS_SYS (setstate_r, int,
491 (char *arg_state, struct random_data *rand_state)); 698 (char *arg_state, struct random_data *rand_state));
699# endif
492_GL_CXXALIASWARN (setstate_r); 700_GL_CXXALIASWARN (setstate_r);
493#elif defined GNULIB_POSIXCHECK 701#elif defined GNULIB_POSIXCHECK
494# undef setstate_r 702# undef setstate_r
@@ -501,7 +709,8 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
501 709
502#if @GNULIB_REALLOC_POSIX@ 710#if @GNULIB_REALLOC_POSIX@
503# if @REPLACE_REALLOC@ 711# if @REPLACE_REALLOC@
504# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 712# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
713 || _GL_USE_STDLIB_ALLOC)
505# undef realloc 714# undef realloc
506# define realloc rpl_realloc 715# define realloc rpl_realloc
507# endif 716# endif
@@ -511,7 +720,7 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
511_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 720_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
512# endif 721# endif
513_GL_CXXALIASWARN (realloc); 722_GL_CXXALIASWARN (realloc);
514#elif defined GNULIB_POSIXCHECK 723#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
515# undef realloc 724# undef realloc
516/* Assume realloc is always declared. */ 725/* Assume realloc is always declared. */
517_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " 726_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
@@ -558,6 +767,22 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
558# endif 767# endif
559#endif 768#endif
560 769
770#if @GNULIB_SECURE_GETENV@
771/* Look up NAME in the environment, returning 0 in insecure situations. */
772# if !@HAVE_SECURE_GETENV@
773_GL_FUNCDECL_SYS (secure_getenv, char *,
774 (char const *name) _GL_ARG_NONNULL ((1)));
775# endif
776_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
777_GL_CXXALIASWARN (secure_getenv);
778#elif defined GNULIB_POSIXCHECK
779# undef secure_getenv
780# if HAVE_RAW_DECL_SECURE_GETENV
781_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
782 "use gnulib module secure_getenv for portability");
783# endif
784#endif
785
561#if @GNULIB_SETENV@ 786#if @GNULIB_SETENV@
562/* Set NAME to VALUE in the environment. 787/* Set NAME to VALUE in the environment.
563 If REPLACE is nonzero, overwrite an existing value. */ 788 If REPLACE is nonzero, overwrite an existing value. */
@@ -572,7 +797,7 @@ _GL_FUNCDECL_RPL (setenv, int,
572_GL_CXXALIAS_RPL (setenv, int, 797_GL_CXXALIAS_RPL (setenv, int,
573 (const char *name, const char *value, int replace)); 798 (const char *name, const char *value, int replace));
574# else 799# else
575# if !@HAVE_SETENV@ 800# if !@HAVE_DECL_SETENV@
576_GL_FUNCDECL_SYS (setenv, int, 801_GL_FUNCDECL_SYS (setenv, int,
577 (const char *name, const char *value, int replace) 802 (const char *name, const char *value, int replace)
578 _GL_ARG_NONNULL ((1))); 803 _GL_ARG_NONNULL ((1)));
@@ -580,7 +805,9 @@ _GL_FUNCDECL_SYS (setenv, int,
580_GL_CXXALIAS_SYS (setenv, int, 805_GL_CXXALIAS_SYS (setenv, int,
581 (const char *name, const char *value, int replace)); 806 (const char *name, const char *value, int replace));
582# endif 807# endif
808# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
583_GL_CXXALIASWARN (setenv); 809_GL_CXXALIASWARN (setenv);
810# endif
584#elif defined GNULIB_POSIXCHECK 811#elif defined GNULIB_POSIXCHECK
585# undef setenv 812# undef setenv
586# if HAVE_RAW_DECL_SETENV 813# if HAVE_RAW_DECL_SETENV
@@ -675,7 +902,7 @@ _GL_CXXALIASWARN (unlockpt);
675#elif defined GNULIB_POSIXCHECK 902#elif defined GNULIB_POSIXCHECK
676# undef unlockpt 903# undef unlockpt
677# if HAVE_RAW_DECL_UNLOCKPT 904# if HAVE_RAW_DECL_UNLOCKPT
678_GL_WARN_ON_USE (ptsname, "unlockpt is not portable - " 905_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
679 "use gnulib module unlockpt for portability"); 906 "use gnulib module unlockpt for portability");
680# endif 907# endif
681#endif 908#endif
@@ -690,12 +917,14 @@ _GL_WARN_ON_USE (ptsname, "unlockpt is not portable - "
690_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 917_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
691_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 918_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
692# else 919# else
693# if !@HAVE_UNSETENV@ 920# if !@HAVE_DECL_UNSETENV@
694_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 921_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
695# endif 922# endif
696_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 923_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
697# endif 924# endif
925# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
698_GL_CXXALIASWARN (unsetenv); 926_GL_CXXALIASWARN (unsetenv);
927# endif
699#elif defined GNULIB_POSIXCHECK 928#elif defined GNULIB_POSIXCHECK
700# undef unsetenv 929# undef unsetenv
701# if HAVE_RAW_DECL_UNSETENV 930# if HAVE_RAW_DECL_UNSETENV
@@ -704,7 +933,22 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
704# endif 933# endif
705#endif 934#endif
706 935
936/* Convert a wide character to a multibyte character. */
937#if @GNULIB_WCTOMB@
938# if @REPLACE_WCTOMB@
939# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
940# undef wctomb
941# define wctomb rpl_wctomb
942# endif
943_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
944_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
945# else
946_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
947# endif
948_GL_CXXALIASWARN (wctomb);
949#endif
950
707 951
708#endif /* _GL_STDLIB_H */ 952#endif /* _@GUARD_PREFIX@_STDLIB_H */
709#endif /* _GL_STDLIB_H */ 953#endif /* _@GUARD_PREFIX@_STDLIB_H */
710#endif 954#endif