X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fstdlib.in.h;h=c9552480e5defca62e8d8480aeb7518c76bebb18;hb=931b01b091932a1f796c23379ea32abb68bd5895;hp=2697a4bd1dbd3687f270eb33210bd164958f3916;hpb=7be93f2d05131d061bd4790ae33c8d50f50010d7;p=platform%2Fupstream%2Fm4.git diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 2697a4b..c955248 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,22 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_malloc_and_calloc -/* Special invocation convention inside glibc header files. */ +#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc +/* Special invocation conventions inside some gnulib header files, + and inside some glibc header files, respectively. */ #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ #else /* Normal invocation convention. */ -#ifndef _GL_STDLIB_H +#ifndef _@GUARD_PREFIX@_STDLIB_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ -#ifndef _GL_STDLIB_H -#define _GL_STDLIB_H +#ifndef _@GUARD_PREFIX@_STDLIB_H +#define _@GUARD_PREFIX@_STDLIB_H /* NetBSD 5.0 mis-defines NULL. */ #include @@ -49,6 +50,11 @@ # include #endif +/* Native Windows platforms declare mktemp() in . */ +#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +# include +#endif + #if @GNULIB_RANDOM_R@ /* OSF/1 5.1 declares 'struct random_data' in , which is included @@ -58,7 +64,7 @@ # include # endif -# if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@ +# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ # include # endif @@ -81,19 +87,24 @@ struct random_data # endif #endif -#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) -/* On MacOS X 10.3, only declares mkstemp. */ +#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +/* On Mac OS X 10.3, only declares mkstemp. */ +/* On Mac OS X 10.5, only declares mkstemps. */ /* On Cygwin 1.7.1, only declares getsubopt. */ /* But avoid namespace pollution on glibc systems and native Windows. */ # include #endif -#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__ -# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) #else -# define _GL_ATTRIBUTE_NORETURN +# define _GL_ATTRIBUTE_PURE /* empty */ #endif +/* The definition of _Noreturn is copied here. */ + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -119,7 +130,7 @@ struct random_data /* Terminate the current process with the given return code, without running the 'atexit' handlers. */ # if !@HAVE__EXIT@ -_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN); +_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); # endif _GL_CXXALIAS_SYS (_Exit, void, (int status)); _GL_CXXALIASWARN (_Exit); @@ -136,7 +147,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " /* Parse a signed decimal integer. Returns the value of the integer. Errors are not detected. */ # if !@HAVE_ATOLL@ -_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (atoll, long long, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); _GL_CXXALIASWARN (atoll); @@ -250,14 +263,19 @@ _GL_CXXALIASWARN (grantpt); #elif defined GNULIB_POSIXCHECK # undef grantpt # if HAVE_RAW_DECL_GRANTPT -_GL_WARN_ON_USE (ptsname, "grantpt is not portable - " +_GL_WARN_ON_USE (grantpt, "grantpt is not portable - " "use gnulib module grantpt for portability"); # endif #endif +/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not + rely on GNU or POSIX semantics for malloc and realloc (for example, + by never specifying a zero size), so it does not need malloc or + realloc to be redefined. */ #if @GNULIB_MALLOC_POSIX@ # if @REPLACE_MALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) # undef malloc # define malloc rpl_malloc # endif @@ -267,7 +285,7 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); # endif _GL_CXXALIASWARN (malloc); -#elif defined GNULIB_POSIXCHECK +#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC # undef malloc /* Assume malloc is always declared. */ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " @@ -421,13 +439,38 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " # endif #endif +#if @GNULIB_POSIX_OPENPT@ +/* Return an FD open to the master side of a pseudo-terminal. Flags should + include O_RDWR, and may also include O_NOCTTY. */ +# if !@HAVE_POSIX_OPENPT@ +_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); +# endif +_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); +_GL_CXXALIASWARN (posix_openpt); +#elif defined GNULIB_POSIXCHECK +# undef posix_openpt +# if HAVE_RAW_DECL_POSIX_OPENPT +_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " + "use gnulib module posix_openpt for portability"); +# endif +#endif + #if @GNULIB_PTSNAME@ /* Return the pathname of the pseudo-terminal slave associated with the master FD is open on, or NULL on errors. */ -# if !@HAVE_PTSNAME@ +# if @REPLACE_PTSNAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ptsname +# define ptsname rpl_ptsname +# endif +_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); +_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); +# else +# if !@HAVE_PTSNAME@ _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); -# endif +# endif _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); +# endif _GL_CXXALIASWARN (ptsname); #elif defined GNULIB_POSIXCHECK # undef ptsname @@ -437,6 +480,32 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " # endif #endif +#if @GNULIB_PTSNAME_R@ +/* Set the pathname of the pseudo-terminal slave associated with + the master FD is open on and return 0, or set errno and return + non-zero on errors. */ +# if @REPLACE_PTSNAME_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ptsname_r +# define ptsname_r rpl_ptsname_r +# endif +_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); +_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); +# else +# if !@HAVE_PTSNAME_R@ +_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); +# endif +_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); +# endif +_GL_CXXALIASWARN (ptsname_r); +#elif defined GNULIB_POSIXCHECK +# undef ptsname_r +# if HAVE_RAW_DECL_PTSNAME_R +_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " + "use gnulib module ptsname_r for portability"); +# endif +#endif + #if @GNULIB_PUTENV@ # if @REPLACE_PUTENV@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -460,12 +529,83 @@ _GL_CXXALIASWARN (putenv); # endif #endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (random, long, (void)); +# endif +_GL_CXXALIAS_SYS (random, long, (void)); +_GL_CXXALIASWARN (random); +#elif defined GNULIB_POSIXCHECK +# undef random +# if HAVE_RAW_DECL_RANDOM +_GL_WARN_ON_USE (random, "random is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); +# endif +_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed)); +_GL_CXXALIASWARN (srandom); +#elif defined GNULIB_POSIXCHECK +# undef srandom +# if HAVE_RAW_DECL_SRANDOM +_GL_WARN_ON_USE (srandom, "srandom is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size)); +_GL_CXXALIASWARN (initstate); +#elif defined GNULIB_POSIXCHECK +# undef initstate +# if HAVE_RAW_DECL_INITSTATE_R +_GL_WARN_ON_USE (initstate, "initstate is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); +_GL_CXXALIASWARN (setstate); +#elif defined GNULIB_POSIXCHECK +# undef setstate +# if HAVE_RAW_DECL_SETSTATE_R +_GL_WARN_ON_USE (setstate, "setstate is unportable - " + "use gnulib module random for portability"); +# endif +#endif + + #if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef random_r +# define random_r rpl_random_r +# endif +_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); +# else +# if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) _GL_ARG_NONNULL ((1, 2))); -# endif +# endif _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); +# endif _GL_CXXALIASWARN (random_r); #elif defined GNULIB_POSIXCHECK # undef random_r @@ -476,13 +616,25 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - " #endif #if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef srandom_r +# define srandom_r rpl_srandom_r +# endif +_GL_FUNCDECL_RPL (srandom_r, int, + (unsigned int seed, struct random_data *rand_state) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (srandom_r, int, + (unsigned int seed, struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (srandom_r, int, (unsigned int seed, struct random_data *rand_state) _GL_ARG_NONNULL ((2))); -# endif +# endif _GL_CXXALIAS_SYS (srandom_r, int, (unsigned int seed, struct random_data *rand_state)); +# endif _GL_CXXALIASWARN (srandom_r); #elif defined GNULIB_POSIXCHECK # undef srandom_r @@ -493,15 +645,29 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " #endif #if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef initstate_r +# define initstate_r rpl_initstate_r +# endif +_GL_FUNCDECL_RPL (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state) + _GL_ARG_NONNULL ((2, 4))); +_GL_CXXALIAS_RPL (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, struct random_data *rand_state) _GL_ARG_NONNULL ((2, 4))); -# endif +# endif _GL_CXXALIAS_SYS (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, struct random_data *rand_state)); +# endif _GL_CXXALIASWARN (initstate_r); #elif defined GNULIB_POSIXCHECK # undef initstate_r @@ -512,13 +678,25 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " #endif #if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setstate_r +# define setstate_r rpl_setstate_r +# endif +_GL_FUNCDECL_RPL (setstate_r, int, + (char *arg_state, struct random_data *rand_state) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (setstate_r, int, + (char *arg_state, struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (setstate_r, int, (char *arg_state, struct random_data *rand_state) _GL_ARG_NONNULL ((1, 2))); -# endif +# endif _GL_CXXALIAS_SYS (setstate_r, int, (char *arg_state, struct random_data *rand_state)); +# endif _GL_CXXALIASWARN (setstate_r); #elif defined GNULIB_POSIXCHECK # undef setstate_r @@ -531,7 +709,8 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " #if @GNULIB_REALLOC_POSIX@ # if @REPLACE_REALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) # undef realloc # define realloc rpl_realloc # endif @@ -541,7 +720,7 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); # endif _GL_CXXALIASWARN (realloc); -#elif defined GNULIB_POSIXCHECK +#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC # undef realloc /* Assume realloc is always declared. */ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " @@ -588,6 +767,22 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " # endif #endif +#if @GNULIB_SECURE_GETENV@ +/* Look up NAME in the environment, returning 0 in insecure situations. */ +# if !@HAVE_SECURE_GETENV@ +_GL_FUNCDECL_SYS (secure_getenv, char *, + (char const *name) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); +_GL_CXXALIASWARN (secure_getenv); +#elif defined GNULIB_POSIXCHECK +# undef secure_getenv +# if HAVE_RAW_DECL_SECURE_GETENV +_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " + "use gnulib module secure_getenv for portability"); +# endif +#endif + #if @GNULIB_SETENV@ /* Set NAME to VALUE in the environment. If REPLACE is nonzero, overwrite an existing value. */ @@ -754,6 +949,6 @@ _GL_CXXALIASWARN (wctomb); #endif -#endif /* _GL_STDLIB_H */ -#endif /* _GL_STDLIB_H */ +#endif /* _@GUARD_PREFIX@_STDLIB_H */ +#endif /* _@GUARD_PREFIX@_STDLIB_H */ #endif