105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* A GNU-like <stdlib.h>.
305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Copyright (C) 1995, 2001-2004, 2006-2012 Free Software Foundation, Inc.
505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This program is free software: you can redistribute it and/or modify
705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   it under the terms of the GNU General Public License as published by
805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   the Free Software Foundation; either version 3 of the License, or
905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   (at your option) any later version.
1005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This program is distributed in the hope that it will be useful,
1205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   but WITHOUT ANY WARRANTY; without even the implied warranty of
1305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   GNU General Public License for more details.
1505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   You should have received a copy of the GNU General Public License
1705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
1805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if __GNUC__ >= 3
2005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#pragma GCC system_header
2105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
2205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __need_malloc_and_calloc
2505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Special invocation convention inside glibc header files.  */
2605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#include_next <stdlib.h>
2805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
3005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Normal invocation convention.  */
3105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_STDLIB_H
3305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The include_next requires a split double-inclusion guard.  */
3505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#include_next <stdlib.h>
3605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_STDLIB_H
3805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_STDLIB_H
3905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
4005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* NetBSD 5.0 mis-defines NULL.  */
4105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#include <stddef.h>
4205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
4305436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.  */
4405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0 && !defined WEXITSTATUS
4505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <sys/wait.h>
4605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
4705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
4805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Solaris declares getloadavg() in <sys/loadavg.h>.  */
4905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if (0 || defined GNULIB_POSIXCHECK) && 0
5005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <sys/loadavg.h>
5105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
5205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
5305436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Native Windows platforms declare mktemp() in <io.h>.  */
5405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
5505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <io.h>
5605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
5705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
5805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
5905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
6005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
6105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   from <stdlib.h> if _REENTRANT is defined.  Include it whenever we need
6205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   'struct random_data'.  */
6305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 1
6405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  include <random.h>
6505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
6605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
6705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1 || 0 || !1
6805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  include <stdint.h>
6905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
7005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
7105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
7205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Define 'struct random_data'.
7305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   But allow multiple gnulib generated <stdlib.h> replacements to coexist.  */
7405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !GNULIB_defined_struct_random_data
7505436638acc7c010349a69c3395f1a57c642dc62Ying Wangstruct random_data
7605436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
7705436638acc7c010349a69c3395f1a57c642dc62Ying Wang  int32_t *fptr;                /* Front pointer.  */
7805436638acc7c010349a69c3395f1a57c642dc62Ying Wang  int32_t *rptr;                /* Rear pointer.  */
7905436638acc7c010349a69c3395f1a57c642dc62Ying Wang  int32_t *state;               /* Array of state values.  */
8005436638acc7c010349a69c3395f1a57c642dc62Ying Wang  int rand_type;                /* Type of random number generator.  */
8105436638acc7c010349a69c3395f1a57c642dc62Ying Wang  int rand_deg;                 /* Degree of random number generator.  */
8205436638acc7c010349a69c3395f1a57c642dc62Ying Wang  int rand_sep;                 /* Distance between front and rear.  */
8305436638acc7c010349a69c3395f1a57c642dc62Ying Wang  int32_t *end_ptr;             /* Pointer behind state table.  */
8405436638acc7c010349a69c3395f1a57c642dc62Ying Wang};
8505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define GNULIB_defined_struct_random_data 1
8605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
8705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
8805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
8905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
9005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if (0 || 0 || 0 || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
9105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* On Mac OS X 10.3, only <unistd.h> declares mkstemp.  */
9205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* On Mac OS X 10.5, only <unistd.h> declares mkstemps.  */
9305436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
9405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* But avoid namespace pollution on glibc systems and native Windows.  */
9505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <unistd.h>
9605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
9705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
9805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The __attribute__ feature is available in gcc versions 2.5 and later.
9905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The attribute __pure__ was added in gcc 2.96.  */
10005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
10105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
10205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
10305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_ATTRIBUTE_PURE /* empty */
10405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
10505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
10605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The definition of _Noreturn is copied here.  */
10705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if !defined _Noreturn && __STDC_VERSION__ < 201112
10805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
10905436638acc7c010349a69c3395f1a57c642dc62Ying Wang      || 0x5110 <= __SUNPRO_C)
11005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _Noreturn __attribute__ ((__noreturn__))
11105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif 1200 <= _MSC_VER
11205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _Noreturn __declspec (noreturn)
11305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
11405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _Noreturn
11505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
11605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
11705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
11805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
11905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_CXXDEFS_H
12005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_CXXDEFS_H
12105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
12205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The three most frequent use cases of these macros are:
12305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
12405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   * For providing a substitute for a function that is missing on some
12505436638acc7c010349a69c3395f1a57c642dc62Ying Wang     platforms, but is declared and works fine on the platforms on which
12605436638acc7c010349a69c3395f1a57c642dc62Ying Wang     it exists:
12705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
12805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #if @GNULIB_FOO@
12905436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # if !@HAVE_FOO@
13005436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_FUNCDECL_SYS (foo, ...);
13105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # endif
13205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_SYS (foo, ...);
13305436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIASWARN (foo);
13405436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #elif defined GNULIB_POSIXCHECK
13505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       ...
13605436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #endif
13705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
13805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   * For providing a replacement for a function that exists on all platforms,
13905436638acc7c010349a69c3395f1a57c642dc62Ying Wang     but is broken/insufficient and needs to be replaced on some platforms:
14005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
14105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #if @GNULIB_FOO@
14205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # if @REPLACE_FOO@
14305436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
14405436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #   undef foo
14505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #   define foo rpl_foo
14605436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  endif
14705436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_FUNCDECL_RPL (foo, ...);
14805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_RPL (foo, ...);
14905436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # else
15005436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_SYS (foo, ...);
15105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # endif
15205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIASWARN (foo);
15305436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #elif defined GNULIB_POSIXCHECK
15405436638acc7c010349a69c3395f1a57c642dc62Ying Wang       ...
15505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #endif
15605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
15705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   * For providing a replacement for a function that exists on some platforms
15805436638acc7c010349a69c3395f1a57c642dc62Ying Wang     but is broken/insufficient and needs to be replaced on some of them and
15905436638acc7c010349a69c3395f1a57c642dc62Ying Wang     is additionally either missing or undeclared on some other platforms:
16005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
16105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #if @GNULIB_FOO@
16205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # if @REPLACE_FOO@
16305436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
16405436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #   undef foo
16505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #   define foo rpl_foo
16605436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  endif
16705436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_FUNCDECL_RPL (foo, ...);
16805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_RPL (foo, ...);
16905436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # else
17005436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
17105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_FUNCDECL_SYS (foo, ...);
17205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  endif
17305436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_SYS (foo, ...);
17405436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # endif
17505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIASWARN (foo);
17605436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #elif defined GNULIB_POSIXCHECK
17705436638acc7c010349a69c3395f1a57c642dc62Ying Wang       ...
17805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #endif
17905436638acc7c010349a69c3395f1a57c642dc62Ying Wang*/
18005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
18105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_EXTERN_C declaration;
18205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   performs the declaration with C linkage.  */
18305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus
18405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_EXTERN_C extern "C"
18505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
18605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_EXTERN_C extern
18705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
18805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
18905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
19005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declares a replacement function, named rpl_func, with the given prototype,
19105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   consisting of return type, parameters, and attributes.
19205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Example:
19305436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
19405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                  _GL_ARG_NONNULL ((1)));
19505436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
19605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
19705436638acc7c010349a69c3395f1a57c642dc62Ying Wang  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
19805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
19905436638acc7c010349a69c3395f1a57c642dc62Ying Wang  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
20005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
20105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
20205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declares the system function, named func, with the given prototype,
20305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   consisting of return type, parameters, and attributes.
20405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Example:
20505436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
20605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                  _GL_ARG_NONNULL ((1)));
20705436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
20805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
20905436638acc7c010349a69c3395f1a57c642dc62Ying Wang  _GL_EXTERN_C rettype func parameters_and_attributes
21005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
21105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_RPL (func, rettype, parameters);
21205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declares a C++ alias called GNULIB_NAMESPACE::func
21305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
21405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Example:
21505436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
21605436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
21705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
21805436638acc7c010349a69c3395f1a57c642dc62Ying Wang  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
21905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
22005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
22105436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                                \
22205436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                                         \
22305436638acc7c010349a69c3395f1a57c642dc62Ying Wang      rettype (*const func) parameters = ::rpl_func;          \
22405436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                                         \
22505436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
22605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
22705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
22805436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
22905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
23005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
23105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
23205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
23305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   except that the C function rpl_func may have a slightly different
23405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declaration.  A cast is used to silence the "invalid conversion" error
23505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   that would otherwise occur.  */
23605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
23705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
23805436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                                     \
23905436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                                              \
24005436638acc7c010349a69c3395f1a57c642dc62Ying Wang      rettype (*const func) parameters =                           \
24105436638acc7c010349a69c3395f1a57c642dc62Ying Wang        reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
24205436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                                              \
24305436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
24405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
24505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
24605436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
24705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
24805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
24905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_SYS (func, rettype, parameters);
25005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declares a C++ alias called GNULIB_NAMESPACE::func
25105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   that redirects to the system provided function func, if GNULIB_NAMESPACE
25205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is defined.
25305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Example:
25405436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
25505436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
25605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
25705436638acc7c010349a69c3395f1a57c642dc62Ying Wang  /* If we were to write
25805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       rettype (*const func) parameters = ::func;
25905436638acc7c010349a69c3395f1a57c642dc62Ying Wang     like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
26005436638acc7c010349a69c3395f1a57c642dc62Ying Wang     better (remove an indirection through a 'static' pointer variable),
26105436638acc7c010349a69c3395f1a57c642dc62Ying Wang     but then the _GL_CXXALIASWARN macro below would cause a warning not only
26205436638acc7c010349a69c3395f1a57c642dc62Ying Wang     for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
26305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
26405436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                     \
26505436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                              \
26605436638acc7c010349a69c3395f1a57c642dc62Ying Wang      static rettype (*func) parameters = ::func;  \
26705436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                              \
26805436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
26905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
27005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
27105436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
27205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
27305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
27405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
27505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
27605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   except that the C function func may have a slightly different declaration.
27705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   A cast is used to silence the "invalid conversion" error that would
27805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   otherwise occur.  */
27905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
28005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
28105436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                          \
28205436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                                   \
28305436638acc7c010349a69c3395f1a57c642dc62Ying Wang      static rettype (*func) parameters =               \
28405436638acc7c010349a69c3395f1a57c642dc62Ying Wang        reinterpret_cast<rettype(*)parameters>(::func); \
28505436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                                   \
28605436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
28705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
28805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
28905436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
29005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
29105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
29205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
29305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
29405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   except that the C function is picked among a set of overloaded functions,
29505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   namely the one with rettype2 and parameters2.  Two consecutive casts
29605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   are used to silence the "cannot find a match" and "invalid conversion"
29705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   errors that would otherwise occur.  */
29805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
29905436638acc7c010349a69c3395f1a57c642dc62Ying Wang  /* The outer cast must be a reinterpret_cast.
30005436638acc7c010349a69c3395f1a57c642dc62Ying Wang     The inner cast: When the function is defined as a set of overloaded
30105436638acc7c010349a69c3395f1a57c642dc62Ying Wang     functions, it works as a static_cast<>, choosing the designated variant.
30205436638acc7c010349a69c3395f1a57c642dc62Ying Wang     When the function is defined as a single variant, it works as a
30305436638acc7c010349a69c3395f1a57c642dc62Ying Wang     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
30405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
30505436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                                                \
30605436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                                                         \
30705436638acc7c010349a69c3395f1a57c642dc62Ying Wang      static rettype (*func) parameters =                                     \
30805436638acc7c010349a69c3395f1a57c642dc62Ying Wang        reinterpret_cast<rettype(*)parameters>(                               \
30905436638acc7c010349a69c3395f1a57c642dc62Ying Wang          (rettype2(*)parameters2)(::func));                                  \
31005436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                                                         \
31105436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
31205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
31305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
31405436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
31505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
31605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
31705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIASWARN (func);
31805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   causes a warning to be emitted when ::func is used but not when
31905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
32005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   variants.  */
32105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
32205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN(func) \
32305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
32405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN_1(func,namespace) \
32505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   _GL_CXXALIASWARN_2 (func, namespace)
32605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
32705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   we enable the warning only when not optimizing.  */
32805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !__OPTIMIZE__
32905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN_2(func,namespace) \
33005436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_WARN_ON_USE (func, \
33105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                     "The symbol ::" #func " refers to the system function. " \
33205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                     "Use " #namespace "::" #func " instead.")
33305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
33405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN_2(func,namespace) \
33505436638acc7c010349a69c3395f1a57c642dc62Ying Wang     extern __typeof__ (func) func
33605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
33705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN_2(func,namespace) \
33805436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_EXTERN_C int _gl_cxxalias_dummy
33905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
34005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
34105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN(func) \
34205436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
34305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
34405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
34505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
34605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   causes a warning to be emitted when the given overloaded variant of ::func
34705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is used but not when GNULIB_NAMESPACE::func is used.  */
34805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
34905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
35005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
35105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                        GNULIB_NAMESPACE)
35205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
35305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
35405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
35505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   we enable the warning only when not optimizing.  */
35605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !__OPTIMIZE__
35705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
35805436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
35905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                         "The symbol ::" #func " refers to the system function. " \
36005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                         "Use " #namespace "::" #func " instead.")
36105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
36205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
36305436638acc7c010349a69c3395f1a57c642dc62Ying Wang     extern __typeof__ (func) func
36405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
36505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
36605436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_EXTERN_C int _gl_cxxalias_dummy
36705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
36805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
36905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
37005436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
37105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
37205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
37305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif /* _GL_CXXDEFS_H */
37405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
37505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The definition of _GL_ARG_NONNULL is copied here.  */
37605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
37705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   that the values passed as arguments n, ..., m must be non-NULL pointers.
37805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
37905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_ARG_NONNULL
38005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
38105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
38205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
38305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_ARG_NONNULL(params)
38405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
38505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
38605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
38705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The definition of _GL_WARN_ON_USE is copied here.  */
38805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_WARN_ON_USE
38905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
39005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
39105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
39205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE(function, message) \
39305436638acc7c010349a69c3395f1a57c642dc62Ying Wangextern __typeof__ (function) function __attribute__ ((__warning__ (message)))
39405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
39505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Verify the existence of the function.  */
39605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE(function, message) \
39705436638acc7c010349a69c3395f1a57c642dc62Ying Wangextern __typeof__ (function) function
39805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else /* Unsupported.  */
39905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE(function, message) \
40005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_EXTERN_C int _gl_warn_on_use
40105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
40205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
40305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
40405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
40505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is like _GL_WARN_ON_USE (function, "string"), except that the function is
40605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declared with the given prototype, consisting of return type, parameters,
40705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   and attributes.
40805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
40905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   not work in this case.  */
41005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_WARN_ON_USE_CXX
41105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
41205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
41305436638acc7c010349a69c3395f1a57c642dc62Ying Wangextern rettype function parameters_and_attributes \
41405436638acc7c010349a69c3395f1a57c642dc62Ying Wang     __attribute__ ((__warning__ (msg)))
41505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
41605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Verify the existence of the function.  */
41705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
41805436638acc7c010349a69c3395f1a57c642dc62Ying Wangextern rettype function parameters_and_attributes
41905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else /* Unsupported.  */
42005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
42105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_EXTERN_C int _gl_warn_on_use
42205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
42305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
42405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
42505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_WARN_EXTERN_C declaration;
42605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   performs the declaration with C linkage.  */
42705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_WARN_EXTERN_C
42805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if defined __cplusplus
42905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_EXTERN_C extern "C"
43005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
43105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_EXTERN_C extern
43205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
43305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
43405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
43505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
43605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
43705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef EXIT_SUCCESS
43805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define EXIT_SUCCESS 0
43905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
44005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
44105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   with proper operation of xargs.  */
44205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef EXIT_FAILURE
44305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define EXIT_FAILURE 1
44405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif EXIT_FAILURE != 1
44505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef EXIT_FAILURE
44605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define EXIT_FAILURE 1
44705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
44805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
44905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
45005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
45105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Terminate the current process with the given return code, without running
45205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   the 'atexit' handlers.  */
45305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
45405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
45505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
45605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (_Exit, void, (int status));
45705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (_Exit);
45805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
45905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef _Exit
46005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL__EXIT
46105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
46205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module _Exit for portability");
46305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
46405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
46505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
46605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
46705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
46805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Parse a signed decimal integer.
46905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Returns the value of the integer.  Errors are not detected.  */
47005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
47105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
47205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                    _GL_ATTRIBUTE_PURE
47305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                    _GL_ARG_NONNULL ((1)));
47405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
47505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
47605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (atoll);
47705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
47805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef atoll
47905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_ATOLL
48005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (atoll, "atoll is unportable - "
48105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module atoll for portability");
48205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
48305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
48405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
48505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 1
48605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
48705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
48805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef calloc
48905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define calloc rpl_calloc
49005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
49105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
49205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
49305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
49405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
49505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
49605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (calloc);
49705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
49805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef calloc
49905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Assume calloc is always declared.  */
50005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
50105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module calloc-posix for portability");
50205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
50305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
50405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
50505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
50605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
50705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define canonicalize_file_name rpl_canonicalize_file_name
50805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
50905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
51005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                                  _GL_ARG_NONNULL ((1)));
51105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
51205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
51305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
51405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
51505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                                  _GL_ARG_NONNULL ((1)));
51605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
51705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
51805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
51905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (canonicalize_file_name);
52005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
52105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef canonicalize_file_name
52205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
52305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (canonicalize_file_name,
52405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "canonicalize_file_name is unportable - "
52505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module canonicalize-lgpl for portability");
52605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
52705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
52805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
52905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
53005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Store max(NELEM,3) load average numbers in LOADAVG[].
53105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The three numbers are the load average of the last 1 minute, the last 5
53205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   minutes, and the last 15 minutes, respectively.
53305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   LOADAVG is an array of NELEM numbers.  */
53405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
53505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
53605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                   _GL_ARG_NONNULL ((1)));
53705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
53805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
53905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (getloadavg);
54005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
54105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef getloadavg
54205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_GETLOADAVG
54305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
54405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module getloadavg for portability");
54505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
54605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
54705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
54805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
54905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Assuming *OPTIONP is a comma separated list of elements of the form
55005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   "token" or "token=value", getsubopt parses the first of these elements.
55105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   If the first element refers to a "token" that is member of the given
55205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   NULL-terminated array of tokens:
55305436638acc7c010349a69c3395f1a57c642dc62Ying Wang     - It replaces the comma with a NUL byte, updates *OPTIONP to point past
55405436638acc7c010349a69c3395f1a57c642dc62Ying Wang       the first option and the comma, sets *VALUEP to the value of the
55505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       element (or NULL if it doesn't contain an "=" sign),
55605436638acc7c010349a69c3395f1a57c642dc62Ying Wang     - It returns the index of the "token" in the given array of tokens.
55705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
55805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   For more details see the POSIX:2001 specification.
55905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   http://www.opengroup.org/susv3xsh/getsubopt.html */
56005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
56105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (getsubopt, int,
56205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char **optionp, char *const *tokens, char **valuep)
56305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((1, 2, 3)));
56405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
56505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (getsubopt, int,
56605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char **optionp, char *const *tokens, char **valuep));
56705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (getsubopt);
56805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
56905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef getsubopt
57005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_GETSUBOPT
57105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
57205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module getsubopt for portability");
57305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
57405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
57505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
57605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
57705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Change the ownership and access permission of the slave side of the
57805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   pseudo-terminal whose master side is specified by FD.  */
57905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
58005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (grantpt, int, (int fd));
58105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
58205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (grantpt, int, (int fd));
58305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (grantpt);
58405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
58505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef grantpt
58605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_GRANTPT
58705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
58805436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module grantpt for portability");
58905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
59005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
59105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
59205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
59305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   rely on GNU or POSIX semantics for malloc and realloc (for example,
59405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   by never specifying a zero size), so it does not need malloc or
59505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   realloc to be redefined.  */
59605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 1
59705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
59805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
59905436638acc7c010349a69c3395f1a57c642dc62Ying Wang        || _GL_USE_STDLIB_ALLOC)
60005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef malloc
60105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define malloc rpl_malloc
60205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
60305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (malloc, void *, (size_t size));
60405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
60505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
60605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
60705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
60805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (malloc);
60905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
61005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef malloc
61105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Assume malloc is always declared.  */
61205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
61305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module malloc-posix for portability");
61405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
61505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
61605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Convert a multibyte character to a wide character.  */
61705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
61805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
61905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
62005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef mbtowc
62105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define mbtowc rpl_mbtowc
62205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
62305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
62405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
62505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
62605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
62705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
62805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mbtowc);
62905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
63005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
63105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
63205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Create a unique temporary directory from TEMPLATE.
63305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The last six characters of TEMPLATE must be "XXXXXX";
63405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   they are replaced with a string that makes the directory name unique.
63505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
63605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The directory is created mode 700.  */
63705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
63805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
63905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
64005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
64105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mkdtemp);
64205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
64305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mkdtemp
64405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MKDTEMP
64505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
64605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mkdtemp for portability");
64705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
64805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
64905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
65005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
65105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Create a unique temporary file from TEMPLATE.
65205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The last six characters of TEMPLATE must be "XXXXXX";
65305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   they are replaced with a string that makes the file name unique.
65405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
65505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   and O_TEXT, O_BINARY (defined in "binary-io.h").
65605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The file is then created, with the specified flags, ensuring it didn't exist
65705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   before.
65805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The file is created read-write (mask at least 0600 & ~umask), but it may be
65905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   world-readable and world-writable (mask 0666 & ~umask), depending on the
66005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   implementation.
66105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Returns the open file descriptor if successful, otherwise -1 and errno
66205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   set.  */
66305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
66405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
66505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                 _GL_ARG_NONNULL ((1)));
66605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
66705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
66805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mkostemp);
66905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
67005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mkostemp
67105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MKOSTEMP
67205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
67305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mkostemp for portability");
67405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
67505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
67605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
67705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
67805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Create a unique temporary file from TEMPLATE.
67905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The last six characters of TEMPLATE before a suffix of length
68005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   SUFFIXLEN must be "XXXXXX";
68105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   they are replaced with a string that makes the file name unique.
68205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
68305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   and O_TEXT, O_BINARY (defined in "binary-io.h").
68405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The file is then created, with the specified flags, ensuring it didn't exist
68505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   before.
68605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The file is created read-write (mask at least 0600 & ~umask), but it may be
68705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   world-readable and world-writable (mask 0666 & ~umask), depending on the
68805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   implementation.
68905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Returns the open file descriptor if successful, otherwise -1 and errno
69005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   set.  */
69105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
69205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mkostemps, int,
69305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char * /*template*/, int /*suffixlen*/, int /*flags*/)
69405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((1)));
69505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
69605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mkostemps, int,
69705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char * /*template*/, int /*suffixlen*/, int /*flags*/));
69805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mkostemps);
69905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
70005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mkostemps
70105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MKOSTEMPS
70205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
70305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mkostemps for portability");
70405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
70505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
70605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
70705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
70805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Create a unique temporary file from TEMPLATE.
70905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The last six characters of TEMPLATE must be "XXXXXX";
71005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   they are replaced with a string that makes the file name unique.
71105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The file is then created, ensuring it didn't exist before.
71205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The file is created read-write (mask at least 0600 & ~umask), but it may be
71305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   world-readable and world-writable (mask 0666 & ~umask), depending on the
71405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   implementation.
71505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Returns the open file descriptor if successful, otherwise -1 and errno
71605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   set.  */
71705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
71805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
71905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define mkstemp rpl_mkstemp
72005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
72105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
72205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
72305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
72405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if ! 1
72505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
72605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
72705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
72805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
72905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mkstemp);
73005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
73105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mkstemp
73205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MKSTEMP
73305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
73405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mkstemp for portability");
73505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
73605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
73705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
73805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
73905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Create a unique temporary file from TEMPLATE.
74005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The last six characters of TEMPLATE prior to a suffix of length
74105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   SUFFIXLEN must be "XXXXXX";
74205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   they are replaced with a string that makes the file name unique.
74305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The file is then created, ensuring it didn't exist before.
74405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The file is created read-write (mask at least 0600 & ~umask), but it may be
74505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   world-readable and world-writable (mask 0666 & ~umask), depending on the
74605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   implementation.
74705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Returns the open file descriptor if successful, otherwise -1 and errno
74805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   set.  */
74905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
75005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
75105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                 _GL_ARG_NONNULL ((1)));
75205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
75305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
75405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mkstemps);
75505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
75605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mkstemps
75705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MKSTEMPS
75805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
75905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mkstemps for portability");
76005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
76105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
76205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
76305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
76405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Return an FD open to the master side of a pseudo-terminal.  Flags should
76505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   include O_RDWR, and may also include O_NOCTTY.  */
76605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
76705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
76805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
76905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
77005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (posix_openpt);
77105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
77205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef posix_openpt
77305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_POSIX_OPENPT
77405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
77505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module posix_openpt for portability");
77605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
77705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
77805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
77905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
78005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Return the pathname of the pseudo-terminal slave associated with
78105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   the master FD is open on, or NULL on errors.  */
78205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
78305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
78405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef ptsname
78505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define ptsname rpl_ptsname
78605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
78705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
78805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
78905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
79005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
79105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
79205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
79305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
79405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
79505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (ptsname);
79605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
79705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef ptsname
79805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_PTSNAME
79905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
80005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module ptsname for portability");
80105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
80205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
80305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
80405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
80505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Set the pathname of the pseudo-terminal slave associated with
80605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   the master FD is open on and return 0, or set errno and return
80705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   non-zero on errors.  */
80805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
80905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
81005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef ptsname_r
81105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define ptsname_r rpl_ptsname_r
81205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
81305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
81405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
81505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
81605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
81705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
81805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
81905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
82005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
82105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (ptsname_r);
82205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
82305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef ptsname_r
82405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_PTSNAME_R
82505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
82605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module ptsname_r for portability");
82705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
82805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
82905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
83005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
83105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
83205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
83305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef putenv
83405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define putenv rpl_putenv
83505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
83605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
83705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (putenv, int, (char *string));
83805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
83905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (putenv, int, (char *string));
84005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
84105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (putenv);
84205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
84305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
84405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
84505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
84605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
84705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  ifndef RAND_MAX
84805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define RAND_MAX 2147483647
84905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
85005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
85105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
85205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
85305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
85405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
85505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
85605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (random, long, (void));
85705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
85805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (random, long, (void));
85905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (random);
86005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
86105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef random
86205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_RANDOM
86305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (random, "random is unportable - "
86405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module random for portability");
86505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
86605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
86705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
86805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
86905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
87005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
87105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
87205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
87305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (srandom);
87405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
87505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef srandom
87605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_SRANDOM
87705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (srandom, "srandom is unportable - "
87805436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module random for portability");
87905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
88005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
88105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
88205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
88305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
88405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (initstate, char *,
88505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, char *buf, size_t buf_size)
88605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
88705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
88805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (initstate, char *,
88905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, char *buf, size_t buf_size));
89005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (initstate);
89105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
89205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef initstate
89305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_INITSTATE_R
89405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (initstate, "initstate is unportable - "
89505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module random for portability");
89605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
89705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
89805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
89905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
90005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
90105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
90205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
90305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
90405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (setstate);
90505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
90605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef setstate
90705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_SETSTATE_R
90805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (setstate, "setstate is unportable - "
90905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module random for portability");
91005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
91105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
91205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
91305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
91405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
91505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
91605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
91705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef random_r
91805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define random_r rpl_random_r
91905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
92005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
92105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                 _GL_ARG_NONNULL ((1, 2)));
92205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
92305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
92405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
92505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
92605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                 _GL_ARG_NONNULL ((1, 2)));
92705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
92805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
92905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
93005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (random_r);
93105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
93205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef random_r
93305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_RANDOM_R
93405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (random_r, "random_r is unportable - "
93505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module random_r for portability");
93605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
93705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
93805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
93905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
94005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
94105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
94205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef srandom_r
94305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define srandom_r rpl_srandom_r
94405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
94505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (srandom_r, int,
94605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, struct random_data *rand_state)
94705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
94805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (srandom_r, int,
94905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, struct random_data *rand_state));
95005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
95105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
95205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (srandom_r, int,
95305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, struct random_data *rand_state)
95405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
95505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
95605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (srandom_r, int,
95705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, struct random_data *rand_state));
95805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
95905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (srandom_r);
96005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
96105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef srandom_r
96205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_SRANDOM_R
96305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
96405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module random_r for portability");
96505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
96605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
96705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
96805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
96905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
97005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
97105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef initstate_r
97205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define initstate_r rpl_initstate_r
97305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
97405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (initstate_r, int,
97505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, char *buf, size_t buf_size,
97605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   struct random_data *rand_state)
97705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2, 4)));
97805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (initstate_r, int,
97905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, char *buf, size_t buf_size,
98005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   struct random_data *rand_state));
98105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
98205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
98305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (initstate_r, int,
98405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, char *buf, size_t buf_size,
98505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   struct random_data *rand_state)
98605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2, 4)));
98705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
98805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (initstate_r, int,
98905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (unsigned int seed, char *buf, size_t buf_size,
99005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   struct random_data *rand_state));
99105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
99205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (initstate_r);
99305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
99405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef initstate_r
99505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_INITSTATE_R
99605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
99705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module random_r for portability");
99805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
99905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
100005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
100105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
100205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
100305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
100405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef setstate_r
100505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define setstate_r rpl_setstate_r
100605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
100705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (setstate_r, int,
100805436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *arg_state, struct random_data *rand_state)
100905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((1, 2)));
101005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (setstate_r, int,
101105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *arg_state, struct random_data *rand_state));
101205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
101305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
101405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (setstate_r, int,
101505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *arg_state, struct random_data *rand_state)
101605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((1, 2)));
101705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
101805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (setstate_r, int,
1019