1*f9f21a71Sskrll /* This file is automatically generated.  DO NOT EDIT! */
2*f9f21a71Sskrll /* Generated from: NetBSD: mknative-gdb,v 1.15 2020/12/05 21:27:31 christos Exp  */
3*f9f21a71Sskrll /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp  */
4*f9f21a71Sskrll 
5*f9f21a71Sskrll /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
6*f9f21a71Sskrll /* A GNU-like <stdlib.h>.
7*f9f21a71Sskrll 
8*f9f21a71Sskrll    Copyright (C) 1995, 2001-2004, 2006-2020 Free Software Foundation, Inc.
9*f9f21a71Sskrll 
10*f9f21a71Sskrll    This program is free software: you can redistribute it and/or modify
11*f9f21a71Sskrll    it under the terms of the GNU General Public License as published by
12*f9f21a71Sskrll    the Free Software Foundation; either version 3 of the License, or
13*f9f21a71Sskrll    (at your option) any later version.
14*f9f21a71Sskrll 
15*f9f21a71Sskrll    This program is distributed in the hope that it will be useful,
16*f9f21a71Sskrll    but WITHOUT ANY WARRANTY; without even the implied warranty of
17*f9f21a71Sskrll    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*f9f21a71Sskrll    GNU General Public License for more details.
19*f9f21a71Sskrll 
20*f9f21a71Sskrll    You should have received a copy of the GNU General Public License
21*f9f21a71Sskrll    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
22*f9f21a71Sskrll 
23*f9f21a71Sskrll #if __GNUC__ >= 3
24*f9f21a71Sskrll #pragma GCC system_header
25*f9f21a71Sskrll #endif
26*f9f21a71Sskrll 
27*f9f21a71Sskrll 
28*f9f21a71Sskrll #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
29*f9f21a71Sskrll /* Special invocation conventions inside some gnulib header files,
30*f9f21a71Sskrll    and inside some glibc header files, respectively.  */
31*f9f21a71Sskrll 
32*f9f21a71Sskrll #include_next <stdlib.h>
33*f9f21a71Sskrll 
34*f9f21a71Sskrll #else
35*f9f21a71Sskrll /* Normal invocation convention.  */
36*f9f21a71Sskrll 
37*f9f21a71Sskrll #ifndef _GL_STDLIB_H
38*f9f21a71Sskrll 
39*f9f21a71Sskrll /* The include_next requires a split double-inclusion guard.  */
40*f9f21a71Sskrll #include_next <stdlib.h>
41*f9f21a71Sskrll 
42*f9f21a71Sskrll #ifndef _GL_STDLIB_H
43*f9f21a71Sskrll #define _GL_STDLIB_H
44*f9f21a71Sskrll 
45*f9f21a71Sskrll /* NetBSD 5.0 mis-defines NULL.  */
46*f9f21a71Sskrll #include <stddef.h>
47*f9f21a71Sskrll 
48*f9f21a71Sskrll /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.  */
49*f9f21a71Sskrll #if 0 && !defined WEXITSTATUS
50*f9f21a71Sskrll # include <sys/wait.h>
51*f9f21a71Sskrll #endif
52*f9f21a71Sskrll 
53*f9f21a71Sskrll /* Solaris declares getloadavg() in <sys/loadavg.h>.  */
54*f9f21a71Sskrll #if (0 || defined GNULIB_POSIXCHECK) && 0
55*f9f21a71Sskrll /* OpenIndiana has a bug: <sys/time.h> must be included before
56*f9f21a71Sskrll    <sys/loadavg.h>.  */
57*f9f21a71Sskrll # include <sys/time.h>
58*f9f21a71Sskrll # include <sys/loadavg.h>
59*f9f21a71Sskrll #endif
60*f9f21a71Sskrll 
61*f9f21a71Sskrll /* Native Windows platforms declare mktemp() in <io.h>.  */
62*f9f21a71Sskrll #if 0 && (defined _WIN32 && ! defined __CYGWIN__)
63*f9f21a71Sskrll # include <io.h>
64*f9f21a71Sskrll #endif
65*f9f21a71Sskrll 
66*f9f21a71Sskrll #if 0
67*f9f21a71Sskrll 
68*f9f21a71Sskrll /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
69*f9f21a71Sskrll    from <stdlib.h> if _REENTRANT is defined.  Include it whenever we need
70*f9f21a71Sskrll    'struct random_data'.  */
71*f9f21a71Sskrll # if 1
72*f9f21a71Sskrll #  include <random.h>
73*f9f21a71Sskrll # endif
74*f9f21a71Sskrll 
75*f9f21a71Sskrll # if !1 || 0 || !1
76*f9f21a71Sskrll #  include <stdint.h>
77*f9f21a71Sskrll # endif
78*f9f21a71Sskrll 
79*f9f21a71Sskrll # if !1
80*f9f21a71Sskrll /* Define 'struct random_data'.
81*f9f21a71Sskrll    But allow multiple gnulib generated <stdlib.h> replacements to coexist.  */
82*f9f21a71Sskrll #  if !GNULIB_defined_struct_random_data
83*f9f21a71Sskrll struct random_data
84*f9f21a71Sskrll {
85*f9f21a71Sskrll   int32_t *fptr;                /* Front pointer.  */
86*f9f21a71Sskrll   int32_t *rptr;                /* Rear pointer.  */
87*f9f21a71Sskrll   int32_t *state;               /* Array of state values.  */
88*f9f21a71Sskrll   int rand_type;                /* Type of random number generator.  */
89*f9f21a71Sskrll   int rand_deg;                 /* Degree of random number generator.  */
90*f9f21a71Sskrll   int rand_sep;                 /* Distance between front and rear.  */
91*f9f21a71Sskrll   int32_t *end_ptr;             /* Pointer behind state table.  */
92*f9f21a71Sskrll };
93*f9f21a71Sskrll #   define GNULIB_defined_struct_random_data 1
94*f9f21a71Sskrll #  endif
95*f9f21a71Sskrll # endif
96*f9f21a71Sskrll #endif
97*f9f21a71Sskrll 
98*f9f21a71Sskrll #if (0 || 0 || 1 || 0 || 0 || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
99*f9f21a71Sskrll /* On Mac OS X 10.3, only <unistd.h> declares mkstemp.  */
100*f9f21a71Sskrll /* On Mac OS X 10.5, only <unistd.h> declares mkstemps.  */
101*f9f21a71Sskrll /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps.  */
102*f9f21a71Sskrll /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
103*f9f21a71Sskrll /* But avoid namespace pollution on glibc systems and native Windows.  */
104*f9f21a71Sskrll # include <unistd.h>
105*f9f21a71Sskrll #endif
106*f9f21a71Sskrll 
107*f9f21a71Sskrll /* The __attribute__ feature is available in gcc versions 2.5 and later.
108*f9f21a71Sskrll    The attribute __pure__ was added in gcc 2.96.  */
109*f9f21a71Sskrll #ifndef _GL_ATTRIBUTE_PURE
110*f9f21a71Sskrll # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
111*f9f21a71Sskrll #  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
112*f9f21a71Sskrll # else
113*f9f21a71Sskrll #  define _GL_ATTRIBUTE_PURE /* empty */
114*f9f21a71Sskrll # endif
115*f9f21a71Sskrll #endif
116*f9f21a71Sskrll 
117*f9f21a71Sskrll /* The definition of _Noreturn is copied here.  */
118*f9f21a71Sskrll /* A C macro for declaring that a function does not return.
119*f9f21a71Sskrll    Copyright (C) 2011-2020 Free Software Foundation, Inc.
120*f9f21a71Sskrll 
121*f9f21a71Sskrll    This program is free software: you can redistribute it and/or modify it
122*f9f21a71Sskrll    under the terms of the GNU General Public License as published
123*f9f21a71Sskrll    by the Free Software Foundation; either version 3 of the License, or
124*f9f21a71Sskrll    (at your option) any later version.
125*f9f21a71Sskrll 
126*f9f21a71Sskrll    This program is distributed in the hope that it will be useful,
127*f9f21a71Sskrll    but WITHOUT ANY WARRANTY; without even the implied warranty of
128*f9f21a71Sskrll    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
129*f9f21a71Sskrll    General Public License for more details.
130*f9f21a71Sskrll 
131*f9f21a71Sskrll    You should have received a copy of the GNU General Public License
132*f9f21a71Sskrll    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
133*f9f21a71Sskrll 
134*f9f21a71Sskrll #ifndef _Noreturn
135*f9f21a71Sskrll # if (defined __cplusplus \
136*f9f21a71Sskrll       && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
137*f9f21a71Sskrll           || (defined _MSC_VER && 1900 <= _MSC_VER)) \
138*f9f21a71Sskrll       && 0)
139*f9f21a71Sskrll     /* [[noreturn]] is not practically usable, because with it the syntax
140*f9f21a71Sskrll          extern _Noreturn void func (...);
141*f9f21a71Sskrll        would not be valid; such a declaration would only be valid with 'extern'
142*f9f21a71Sskrll        and '_Noreturn' swapped, or without the 'extern' keyword.  However, some
143*f9f21a71Sskrll        AIX system header files and several gnulib header files use precisely
144*f9f21a71Sskrll        this syntax with 'extern'.  */
145*f9f21a71Sskrll #  define _Noreturn [[noreturn]]
146*f9f21a71Sskrll # elif ((!defined __cplusplus || defined __clang__)                     \
147*f9f21a71Sskrll         && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)  \
148*f9f21a71Sskrll             || 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
149*f9f21a71Sskrll             || (defined __apple_build_version__ \
150*f9f21a71Sskrll                 ? 6000000 <= __apple_build_version__ \
151*f9f21a71Sskrll                 : 3 < __clang_major__ + (5 <= __clang_minor__))))
152*f9f21a71Sskrll    /* _Noreturn works as-is.  */
153*f9f21a71Sskrll # elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
154*f9f21a71Sskrll #  define _Noreturn __attribute__ ((__noreturn__))
155*f9f21a71Sskrll # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
156*f9f21a71Sskrll #  define _Noreturn __declspec (noreturn)
157*f9f21a71Sskrll # else
158*f9f21a71Sskrll #  define _Noreturn
159*f9f21a71Sskrll # endif
160*f9f21a71Sskrll #endif
161*f9f21a71Sskrll 
162*f9f21a71Sskrll /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
163*f9f21a71Sskrll /* C++ compatible function declaration macros.
164*f9f21a71Sskrll    Copyright (C) 2010-2020 Free Software Foundation, Inc.
165*f9f21a71Sskrll 
166*f9f21a71Sskrll    This program is free software: you can redistribute it and/or modify it
167*f9f21a71Sskrll    under the terms of the GNU General Public License as published
168*f9f21a71Sskrll    by the Free Software Foundation; either version 3 of the License, or
169*f9f21a71Sskrll    (at your option) any later version.
170*f9f21a71Sskrll 
171*f9f21a71Sskrll    This program is distributed in the hope that it will be useful,
172*f9f21a71Sskrll    but WITHOUT ANY WARRANTY; without even the implied warranty of
173*f9f21a71Sskrll    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
174*f9f21a71Sskrll    General Public License for more details.
175*f9f21a71Sskrll 
176*f9f21a71Sskrll    You should have received a copy of the GNU General Public License
177*f9f21a71Sskrll    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
178*f9f21a71Sskrll 
179*f9f21a71Sskrll #ifndef _GL_CXXDEFS_H
180*f9f21a71Sskrll #define _GL_CXXDEFS_H
181*f9f21a71Sskrll 
182*f9f21a71Sskrll /* Begin/end the GNULIB_NAMESPACE namespace.  */
183*f9f21a71Sskrll #if defined __cplusplus && defined GNULIB_NAMESPACE
184*f9f21a71Sskrll # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
185*f9f21a71Sskrll # define _GL_END_NAMESPACE }
186*f9f21a71Sskrll #else
187*f9f21a71Sskrll # define _GL_BEGIN_NAMESPACE
188*f9f21a71Sskrll # define _GL_END_NAMESPACE
189*f9f21a71Sskrll #endif
190*f9f21a71Sskrll 
191*f9f21a71Sskrll /* The three most frequent use cases of these macros are:
192*f9f21a71Sskrll 
193*f9f21a71Sskrll    * For providing a substitute for a function that is missing on some
194*f9f21a71Sskrll      platforms, but is declared and works fine on the platforms on which
195*f9f21a71Sskrll      it exists:
196*f9f21a71Sskrll 
197*f9f21a71Sskrll        #if @GNULIB_FOO@
198*f9f21a71Sskrll        # if !@HAVE_FOO@
199*f9f21a71Sskrll        _GL_FUNCDECL_SYS (foo, ...);
200*f9f21a71Sskrll        # endif
201*f9f21a71Sskrll        _GL_CXXALIAS_SYS (foo, ...);
202*f9f21a71Sskrll        _GL_CXXALIASWARN (foo);
203*f9f21a71Sskrll        #elif defined GNULIB_POSIXCHECK
204*f9f21a71Sskrll        ...
205*f9f21a71Sskrll        #endif
206*f9f21a71Sskrll 
207*f9f21a71Sskrll    * For providing a replacement for a function that exists on all platforms,
208*f9f21a71Sskrll      but is broken/insufficient and needs to be replaced on some platforms:
209*f9f21a71Sskrll 
210*f9f21a71Sskrll        #if @GNULIB_FOO@
211*f9f21a71Sskrll        # if @REPLACE_FOO@
212*f9f21a71Sskrll        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
213*f9f21a71Sskrll        #   undef foo
214*f9f21a71Sskrll        #   define foo rpl_foo
215*f9f21a71Sskrll        #  endif
216*f9f21a71Sskrll        _GL_FUNCDECL_RPL (foo, ...);
217*f9f21a71Sskrll        _GL_CXXALIAS_RPL (foo, ...);
218*f9f21a71Sskrll        # else
219*f9f21a71Sskrll        _GL_CXXALIAS_SYS (foo, ...);
220*f9f21a71Sskrll        # endif
221*f9f21a71Sskrll        _GL_CXXALIASWARN (foo);
222*f9f21a71Sskrll        #elif defined GNULIB_POSIXCHECK
223*f9f21a71Sskrll        ...
224*f9f21a71Sskrll        #endif
225*f9f21a71Sskrll 
226*f9f21a71Sskrll    * For providing a replacement for a function that exists on some platforms
227*f9f21a71Sskrll      but is broken/insufficient and needs to be replaced on some of them and
228*f9f21a71Sskrll      is additionally either missing or undeclared on some other platforms:
229*f9f21a71Sskrll 
230*f9f21a71Sskrll        #if @GNULIB_FOO@
231*f9f21a71Sskrll        # if @REPLACE_FOO@
232*f9f21a71Sskrll        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
233*f9f21a71Sskrll        #   undef foo
234*f9f21a71Sskrll        #   define foo rpl_foo
235*f9f21a71Sskrll        #  endif
236*f9f21a71Sskrll        _GL_FUNCDECL_RPL (foo, ...);
237*f9f21a71Sskrll        _GL_CXXALIAS_RPL (foo, ...);
238*f9f21a71Sskrll        # else
239*f9f21a71Sskrll        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
240*f9f21a71Sskrll        _GL_FUNCDECL_SYS (foo, ...);
241*f9f21a71Sskrll        #  endif
242*f9f21a71Sskrll        _GL_CXXALIAS_SYS (foo, ...);
243*f9f21a71Sskrll        # endif
244*f9f21a71Sskrll        _GL_CXXALIASWARN (foo);
245*f9f21a71Sskrll        #elif defined GNULIB_POSIXCHECK
246*f9f21a71Sskrll        ...
247*f9f21a71Sskrll        #endif
248*f9f21a71Sskrll */
249*f9f21a71Sskrll 
250*f9f21a71Sskrll /* _GL_EXTERN_C declaration;
251*f9f21a71Sskrll    performs the declaration with C linkage.  */
252*f9f21a71Sskrll #if defined __cplusplus
253*f9f21a71Sskrll # define _GL_EXTERN_C extern "C"
254*f9f21a71Sskrll #else
255*f9f21a71Sskrll # define _GL_EXTERN_C extern
256*f9f21a71Sskrll #endif
257*f9f21a71Sskrll 
258*f9f21a71Sskrll /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
259*f9f21a71Sskrll    declares a replacement function, named rpl_func, with the given prototype,
260*f9f21a71Sskrll    consisting of return type, parameters, and attributes.
261*f9f21a71Sskrll    Example:
262*f9f21a71Sskrll      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
263*f9f21a71Sskrll                                   _GL_ARG_NONNULL ((1)));
264*f9f21a71Sskrll  */
265*f9f21a71Sskrll #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
266*f9f21a71Sskrll   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
267*f9f21a71Sskrll #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
268*f9f21a71Sskrll   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
269*f9f21a71Sskrll 
270*f9f21a71Sskrll /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
271*f9f21a71Sskrll    declares the system function, named func, with the given prototype,
272*f9f21a71Sskrll    consisting of return type, parameters, and attributes.
273*f9f21a71Sskrll    Example:
274*f9f21a71Sskrll      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
275*f9f21a71Sskrll                                   _GL_ARG_NONNULL ((1)));
276*f9f21a71Sskrll  */
277*f9f21a71Sskrll #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
278*f9f21a71Sskrll   _GL_EXTERN_C rettype func parameters_and_attributes
279*f9f21a71Sskrll 
280*f9f21a71Sskrll /* _GL_CXXALIAS_RPL (func, rettype, parameters);
281*f9f21a71Sskrll    declares a C++ alias called GNULIB_NAMESPACE::func
282*f9f21a71Sskrll    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
283*f9f21a71Sskrll    Example:
284*f9f21a71Sskrll      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
285*f9f21a71Sskrll 
286*f9f21a71Sskrll    Wrapping rpl_func in an object with an inline conversion operator
287*f9f21a71Sskrll    avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
288*f9f21a71Sskrll    actually used in the program.  */
289*f9f21a71Sskrll #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
290*f9f21a71Sskrll   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
291*f9f21a71Sskrll #if defined __cplusplus && defined GNULIB_NAMESPACE
292*f9f21a71Sskrll # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
293*f9f21a71Sskrll     namespace GNULIB_NAMESPACE                                \
294*f9f21a71Sskrll     {                                                         \
295*f9f21a71Sskrll       static const struct _gl_ ## func ## _wrapper            \
296*f9f21a71Sskrll       {                                                       \
297*f9f21a71Sskrll         typedef rettype (*type) parameters;                   \
298*f9f21a71Sskrll                                                               \
299*f9f21a71Sskrll         inline operator type () const                         \
300*f9f21a71Sskrll         {                                                     \
301*f9f21a71Sskrll           return ::rpl_func;                                  \
302*f9f21a71Sskrll         }                                                     \
303*f9f21a71Sskrll       } func = {};                                            \
304*f9f21a71Sskrll     }                                                         \
305*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
306*f9f21a71Sskrll #else
307*f9f21a71Sskrll # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
308*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
309*f9f21a71Sskrll #endif
310*f9f21a71Sskrll 
311*f9f21a71Sskrll /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
312*f9f21a71Sskrll    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
313*f9f21a71Sskrll    except that the C function rpl_func may have a slightly different
314*f9f21a71Sskrll    declaration.  A cast is used to silence the "invalid conversion" error
315*f9f21a71Sskrll    that would otherwise occur.  */
316*f9f21a71Sskrll #if defined __cplusplus && defined GNULIB_NAMESPACE
317*f9f21a71Sskrll # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
318*f9f21a71Sskrll     namespace GNULIB_NAMESPACE                                     \
319*f9f21a71Sskrll     {                                                              \
320*f9f21a71Sskrll       static const struct _gl_ ## func ## _wrapper                 \
321*f9f21a71Sskrll       {                                                            \
322*f9f21a71Sskrll         typedef rettype (*type) parameters;                        \
323*f9f21a71Sskrll                                                                    \
324*f9f21a71Sskrll         inline operator type () const                              \
325*f9f21a71Sskrll         {                                                          \
326*f9f21a71Sskrll           return reinterpret_cast<type>(::rpl_func);               \
327*f9f21a71Sskrll         }                                                          \
328*f9f21a71Sskrll       } func = {};                                                 \
329*f9f21a71Sskrll     }                                                              \
330*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
331*f9f21a71Sskrll #else
332*f9f21a71Sskrll # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
333*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
334*f9f21a71Sskrll #endif
335*f9f21a71Sskrll 
336*f9f21a71Sskrll /* _GL_CXXALIAS_SYS (func, rettype, parameters);
337*f9f21a71Sskrll    declares a C++ alias called GNULIB_NAMESPACE::func
338*f9f21a71Sskrll    that redirects to the system provided function func, if GNULIB_NAMESPACE
339*f9f21a71Sskrll    is defined.
340*f9f21a71Sskrll    Example:
341*f9f21a71Sskrll      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
342*f9f21a71Sskrll 
343*f9f21a71Sskrll    Wrapping func in an object with an inline conversion operator
344*f9f21a71Sskrll    avoids a reference to func unless GNULIB_NAMESPACE::func is
345*f9f21a71Sskrll    actually used in the program.  */
346*f9f21a71Sskrll #if defined __cplusplus && defined GNULIB_NAMESPACE
347*f9f21a71Sskrll # define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
348*f9f21a71Sskrll     namespace GNULIB_NAMESPACE                                \
349*f9f21a71Sskrll     {                                                         \
350*f9f21a71Sskrll       static const struct _gl_ ## func ## _wrapper            \
351*f9f21a71Sskrll       {                                                       \
352*f9f21a71Sskrll         typedef rettype (*type) parameters;                   \
353*f9f21a71Sskrll                                                               \
354*f9f21a71Sskrll         inline operator type () const                         \
355*f9f21a71Sskrll         {                                                     \
356*f9f21a71Sskrll           return ::func;                                      \
357*f9f21a71Sskrll         }                                                     \
358*f9f21a71Sskrll       } func = {};                                            \
359*f9f21a71Sskrll     }                                                         \
360*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
361*f9f21a71Sskrll #else
362*f9f21a71Sskrll # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
363*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
364*f9f21a71Sskrll #endif
365*f9f21a71Sskrll 
366*f9f21a71Sskrll /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
367*f9f21a71Sskrll    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
368*f9f21a71Sskrll    except that the C function func may have a slightly different declaration.
369*f9f21a71Sskrll    A cast is used to silence the "invalid conversion" error that would
370*f9f21a71Sskrll    otherwise occur.  */
371*f9f21a71Sskrll #if defined __cplusplus && defined GNULIB_NAMESPACE
372*f9f21a71Sskrll # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
373*f9f21a71Sskrll     namespace GNULIB_NAMESPACE                          \
374*f9f21a71Sskrll     {                                                   \
375*f9f21a71Sskrll       static const struct _gl_ ## func ## _wrapper      \
376*f9f21a71Sskrll       {                                                 \
377*f9f21a71Sskrll         typedef rettype (*type) parameters;             \
378*f9f21a71Sskrll                                                         \
379*f9f21a71Sskrll         inline operator type () const                   \
380*f9f21a71Sskrll         {                                               \
381*f9f21a71Sskrll           return reinterpret_cast<type>(::func);        \
382*f9f21a71Sskrll         }                                               \
383*f9f21a71Sskrll       } func = {};                                      \
384*f9f21a71Sskrll     }                                                   \
385*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
386*f9f21a71Sskrll #else
387*f9f21a71Sskrll # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
388*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
389*f9f21a71Sskrll #endif
390*f9f21a71Sskrll 
391*f9f21a71Sskrll /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
392*f9f21a71Sskrll    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
393*f9f21a71Sskrll    except that the C function is picked among a set of overloaded functions,
394*f9f21a71Sskrll    namely the one with rettype2 and parameters2.  Two consecutive casts
395*f9f21a71Sskrll    are used to silence the "cannot find a match" and "invalid conversion"
396*f9f21a71Sskrll    errors that would otherwise occur.  */
397*f9f21a71Sskrll #if defined __cplusplus && defined GNULIB_NAMESPACE
398*f9f21a71Sskrll   /* The outer cast must be a reinterpret_cast.
399*f9f21a71Sskrll      The inner cast: When the function is defined as a set of overloaded
400*f9f21a71Sskrll      functions, it works as a static_cast<>, choosing the designated variant.
401*f9f21a71Sskrll      When the function is defined as a single variant, it works as a
402*f9f21a71Sskrll      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
403*f9f21a71Sskrll # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
404*f9f21a71Sskrll     namespace GNULIB_NAMESPACE                                                \
405*f9f21a71Sskrll     {                                                                         \
406*f9f21a71Sskrll       static const struct _gl_ ## func ## _wrapper                            \
407*f9f21a71Sskrll       {                                                                       \
408*f9f21a71Sskrll         typedef rettype (*type) parameters;                                   \
409*f9f21a71Sskrll                                                                               \
410*f9f21a71Sskrll         inline operator type () const                                         \
411*f9f21a71Sskrll         {                                                                     \
412*f9f21a71Sskrll           return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
413*f9f21a71Sskrll         }                                                                     \
414*f9f21a71Sskrll       } func = {};                                                            \
415*f9f21a71Sskrll     }                                                                         \
416*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
417*f9f21a71Sskrll #else
418*f9f21a71Sskrll # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
419*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
420*f9f21a71Sskrll #endif
421*f9f21a71Sskrll 
422*f9f21a71Sskrll /* _GL_CXXALIASWARN (func);
423*f9f21a71Sskrll    causes a warning to be emitted when ::func is used but not when
424*f9f21a71Sskrll    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
425*f9f21a71Sskrll    variants.  */
426*f9f21a71Sskrll #if defined __cplusplus && defined GNULIB_NAMESPACE
427*f9f21a71Sskrll # define _GL_CXXALIASWARN(func) \
428*f9f21a71Sskrll    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
429*f9f21a71Sskrll # define _GL_CXXALIASWARN_1(func,namespace) \
430*f9f21a71Sskrll    _GL_CXXALIASWARN_2 (func, namespace)
431*f9f21a71Sskrll /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
432*f9f21a71Sskrll    we enable the warning only when not optimizing.  */
433*f9f21a71Sskrll # if !__OPTIMIZE__
434*f9f21a71Sskrll #  define _GL_CXXALIASWARN_2(func,namespace) \
435*f9f21a71Sskrll     _GL_WARN_ON_USE (func, \
436*f9f21a71Sskrll                      "The symbol ::" #func " refers to the system function. " \
437*f9f21a71Sskrll                      "Use " #namespace "::" #func " instead.")
438*f9f21a71Sskrll # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
439*f9f21a71Sskrll #  define _GL_CXXALIASWARN_2(func,namespace) \
440*f9f21a71Sskrll      extern __typeof__ (func) func
441*f9f21a71Sskrll # else
442*f9f21a71Sskrll #  define _GL_CXXALIASWARN_2(func,namespace) \
443*f9f21a71Sskrll      _GL_EXTERN_C int _gl_cxxalias_dummy
444*f9f21a71Sskrll # endif
445*f9f21a71Sskrll #else
446*f9f21a71Sskrll # define _GL_CXXALIASWARN(func) \
447*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
448*f9f21a71Sskrll #endif
449*f9f21a71Sskrll 
450*f9f21a71Sskrll /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
451*f9f21a71Sskrll    causes a warning to be emitted when the given overloaded variant of ::func
452*f9f21a71Sskrll    is used but not when GNULIB_NAMESPACE::func is used.  */
453*f9f21a71Sskrll #if defined __cplusplus && defined GNULIB_NAMESPACE
454*f9f21a71Sskrll # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
455*f9f21a71Sskrll    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
456*f9f21a71Sskrll                         GNULIB_NAMESPACE)
457*f9f21a71Sskrll # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
458*f9f21a71Sskrll    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
459*f9f21a71Sskrll /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
460*f9f21a71Sskrll    we enable the warning only when not optimizing.  */
461*f9f21a71Sskrll # if !__OPTIMIZE__
462*f9f21a71Sskrll #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
463*f9f21a71Sskrll     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
464*f9f21a71Sskrll                          "The symbol ::" #func " refers to the system function. " \
465*f9f21a71Sskrll                          "Use " #namespace "::" #func " instead.")
466*f9f21a71Sskrll # else
467*f9f21a71Sskrll #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
468*f9f21a71Sskrll      _GL_EXTERN_C int _gl_cxxalias_dummy
469*f9f21a71Sskrll # endif
470*f9f21a71Sskrll #else
471*f9f21a71Sskrll # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
472*f9f21a71Sskrll     _GL_EXTERN_C int _gl_cxxalias_dummy
473*f9f21a71Sskrll #endif
474*f9f21a71Sskrll 
475*f9f21a71Sskrll #endif /* _GL_CXXDEFS_H */
476*f9f21a71Sskrll 
477*f9f21a71Sskrll /* The definition of _GL_ARG_NONNULL is copied here.  */
478*f9f21a71Sskrll /* A C macro for declaring that specific arguments must not be NULL.
479*f9f21a71Sskrll    Copyright (C) 2009-2020 Free Software Foundation, Inc.
480*f9f21a71Sskrll 
481*f9f21a71Sskrll    This program is free software: you can redistribute it and/or modify it
482*f9f21a71Sskrll    under the terms of the GNU General Public License as published
483*f9f21a71Sskrll    by the Free Software Foundation; either version 3 of the License, or
484*f9f21a71Sskrll    (at your option) any later version.
485*f9f21a71Sskrll 
486*f9f21a71Sskrll    This program is distributed in the hope that it will be useful,
487*f9f21a71Sskrll    but WITHOUT ANY WARRANTY; without even the implied warranty of
488*f9f21a71Sskrll    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
489*f9f21a71Sskrll    General Public License for more details.
490*f9f21a71Sskrll 
491*f9f21a71Sskrll    You should have received a copy of the GNU General Public License
492*f9f21a71Sskrll    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
493*f9f21a71Sskrll 
494*f9f21a71Sskrll /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
495*f9f21a71Sskrll    that the values passed as arguments n, ..., m must be non-NULL pointers.
496*f9f21a71Sskrll    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
497*f9f21a71Sskrll #ifndef _GL_ARG_NONNULL
498*f9f21a71Sskrll # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
499*f9f21a71Sskrll #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
500*f9f21a71Sskrll # else
501*f9f21a71Sskrll #  define _GL_ARG_NONNULL(params)
502*f9f21a71Sskrll # endif
503*f9f21a71Sskrll #endif
504*f9f21a71Sskrll 
505*f9f21a71Sskrll /* The definition of _GL_WARN_ON_USE is copied here.  */
506*f9f21a71Sskrll /* A C macro for emitting warnings if a function is used.
507*f9f21a71Sskrll    Copyright (C) 2010-2020 Free Software Foundation, Inc.
508*f9f21a71Sskrll 
509*f9f21a71Sskrll    This program is free software: you can redistribute it and/or modify it
510*f9f21a71Sskrll    under the terms of the GNU General Public License as published
511*f9f21a71Sskrll    by the Free Software Foundation; either version 3 of the License, or
512*f9f21a71Sskrll    (at your option) any later version.
513*f9f21a71Sskrll 
514*f9f21a71Sskrll    This program is distributed in the hope that it will be useful,
515*f9f21a71Sskrll    but WITHOUT ANY WARRANTY; without even the implied warranty of
516*f9f21a71Sskrll    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
517*f9f21a71Sskrll    General Public License for more details.
518*f9f21a71Sskrll 
519*f9f21a71Sskrll    You should have received a copy of the GNU General Public License
520*f9f21a71Sskrll    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
521*f9f21a71Sskrll 
522*f9f21a71Sskrll /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
523*f9f21a71Sskrll    for FUNCTION which will then trigger a compiler warning containing
524*f9f21a71Sskrll    the text of "literal string" anywhere that function is called, if
525*f9f21a71Sskrll    supported by the compiler.  If the compiler does not support this
526*f9f21a71Sskrll    feature, the macro expands to an unused extern declaration.
527*f9f21a71Sskrll 
528*f9f21a71Sskrll    _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
529*f9f21a71Sskrll    attribute used in _GL_WARN_ON_USE.  If the compiler does not support
530*f9f21a71Sskrll    this feature, it expands to empty.
531*f9f21a71Sskrll 
532*f9f21a71Sskrll    These macros are useful for marking a function as a potential
533*f9f21a71Sskrll    portability trap, with the intent that "literal string" include
534*f9f21a71Sskrll    instructions on the replacement function that should be used
535*f9f21a71Sskrll    instead.
536*f9f21a71Sskrll    _GL_WARN_ON_USE is for functions with 'extern' linkage.
537*f9f21a71Sskrll    _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
538*f9f21a71Sskrll    linkage.
539*f9f21a71Sskrll 
540*f9f21a71Sskrll    However, one of the reasons that a function is a portability trap is
541*f9f21a71Sskrll    if it has the wrong signature.  Declaring FUNCTION with a different
542*f9f21a71Sskrll    signature in C is a compilation error, so this macro must use the
543*f9f21a71Sskrll    same type as any existing declaration so that programs that avoid
544*f9f21a71Sskrll    the problematic FUNCTION do not fail to compile merely because they
545*f9f21a71Sskrll    included a header that poisoned the function.  But this implies that
546*f9f21a71Sskrll    _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
547*f9f21a71Sskrll    have a declaration.  Use of this macro implies that there must not
548*f9f21a71Sskrll    be any other macro hiding the declaration of FUNCTION; but
549*f9f21a71Sskrll    undefining FUNCTION first is part of the poisoning process anyway
550*f9f21a71Sskrll    (although for symbols that are provided only via a macro, the result
551*f9f21a71Sskrll    is a compilation error rather than a warning containing
552*f9f21a71Sskrll    "literal string").  Also note that in C++, it is only safe to use if
553*f9f21a71Sskrll    FUNCTION has no overloads.
554*f9f21a71Sskrll 
555*f9f21a71Sskrll    For an example, it is possible to poison 'getline' by:
556*f9f21a71Sskrll    - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
557*f9f21a71Sskrll      [getline]) in configure.ac, which potentially defines
558*f9f21a71Sskrll      HAVE_RAW_DECL_GETLINE
559*f9f21a71Sskrll    - adding this code to a header that wraps the system <stdio.h>:
560*f9f21a71Sskrll      #undef getline
561*f9f21a71Sskrll      #if HAVE_RAW_DECL_GETLINE
562*f9f21a71Sskrll      _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
563*f9f21a71Sskrll        "not universally present; use the gnulib module getline");
564*f9f21a71Sskrll      #endif
565*f9f21a71Sskrll 
566*f9f21a71Sskrll    It is not possible to directly poison global variables.  But it is
567*f9f21a71Sskrll    possible to write a wrapper accessor function, and poison that
568*f9f21a71Sskrll    (less common usage, like &environ, will cause a compilation error
569*f9f21a71Sskrll    rather than issue the nice warning, but the end result of informing
570*f9f21a71Sskrll    the developer about their portability problem is still achieved):
571*f9f21a71Sskrll      #if HAVE_RAW_DECL_ENVIRON
572*f9f21a71Sskrll      static char ***
573*f9f21a71Sskrll      rpl_environ (void) { return &environ; }
574*f9f21a71Sskrll      _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
575*f9f21a71Sskrll      # undef environ
576*f9f21a71Sskrll      # define environ (*rpl_environ ())
577*f9f21a71Sskrll      #endif
578*f9f21a71Sskrll    or better (avoiding contradictory use of 'static' and 'extern'):
579*f9f21a71Sskrll      #if HAVE_RAW_DECL_ENVIRON
580*f9f21a71Sskrll      static char ***
581*f9f21a71Sskrll      _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
582*f9f21a71Sskrll      rpl_environ (void) { return &environ; }
583*f9f21a71Sskrll      # undef environ
584*f9f21a71Sskrll      # define environ (*rpl_environ ())
585*f9f21a71Sskrll      #endif
586*f9f21a71Sskrll    */
587*f9f21a71Sskrll #ifndef _GL_WARN_ON_USE
588*f9f21a71Sskrll 
589*f9f21a71Sskrll # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
590*f9f21a71Sskrll /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
591*f9f21a71Sskrll #  define _GL_WARN_ON_USE(function, message) \
592*f9f21a71Sskrll extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
593*f9f21a71Sskrll #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
594*f9f21a71Sskrll   __attribute__ ((__warning__ (message)))
595*f9f21a71Sskrll # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
596*f9f21a71Sskrll /* Verify the existence of the function.  */
597*f9f21a71Sskrll #  define _GL_WARN_ON_USE(function, message) \
598*f9f21a71Sskrll extern __typeof__ (function) function
599*f9f21a71Sskrll #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
600*f9f21a71Sskrll # else /* Unsupported.  */
601*f9f21a71Sskrll #  define _GL_WARN_ON_USE(function, message) \
602*f9f21a71Sskrll _GL_WARN_EXTERN_C int _gl_warn_on_use
603*f9f21a71Sskrll #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
604*f9f21a71Sskrll # endif
605*f9f21a71Sskrll #endif
606*f9f21a71Sskrll 
607*f9f21a71Sskrll /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
608*f9f21a71Sskrll    is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the
609*f9f21a71Sskrll    function is declared with the given prototype, consisting of return type,
610*f9f21a71Sskrll    parameters, and attributes.
611*f9f21a71Sskrll    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
612*f9f21a71Sskrll    not work in this case.  */
613*f9f21a71Sskrll #ifndef _GL_WARN_ON_USE_CXX
614*f9f21a71Sskrll # if !defined __cplusplus
615*f9f21a71Sskrll #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
616*f9f21a71Sskrll      _GL_WARN_ON_USE (function, msg)
617*f9f21a71Sskrll # else
618*f9f21a71Sskrll #  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
619*f9f21a71Sskrll #   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
620*f9f21a71Sskrll extern rettype function parameters_and_attributes \
621*f9f21a71Sskrll      __attribute__ ((__warning__ (msg)))
622*f9f21a71Sskrll #  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
623*f9f21a71Sskrll /* Verify the existence of the function.  */
624*f9f21a71Sskrll #   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
625*f9f21a71Sskrll extern rettype function parameters_and_attributes
626*f9f21a71Sskrll #  else /* Unsupported.  */
627*f9f21a71Sskrll #   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
628*f9f21a71Sskrll _GL_WARN_EXTERN_C int _gl_warn_on_use
629*f9f21a71Sskrll #  endif
630*f9f21a71Sskrll # endif
631*f9f21a71Sskrll #endif
632*f9f21a71Sskrll 
633*f9f21a71Sskrll /* _GL_WARN_EXTERN_C declaration;
634*f9f21a71Sskrll    performs the declaration with C linkage.  */
635*f9f21a71Sskrll #ifndef _GL_WARN_EXTERN_C
636*f9f21a71Sskrll # if defined __cplusplus
637*f9f21a71Sskrll #  define _GL_WARN_EXTERN_C extern "C"
638*f9f21a71Sskrll # else
639*f9f21a71Sskrll #  define _GL_WARN_EXTERN_C extern
640*f9f21a71Sskrll # endif
641*f9f21a71Sskrll #endif
642*f9f21a71Sskrll 
643*f9f21a71Sskrll 
644*f9f21a71Sskrll /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
645*f9f21a71Sskrll #ifndef EXIT_SUCCESS
646*f9f21a71Sskrll # define EXIT_SUCCESS 0
647*f9f21a71Sskrll #endif
648*f9f21a71Sskrll /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
649*f9f21a71Sskrll    with proper operation of xargs.  */
650*f9f21a71Sskrll #ifndef EXIT_FAILURE
651*f9f21a71Sskrll # define EXIT_FAILURE 1
652*f9f21a71Sskrll #elif EXIT_FAILURE != 1
653*f9f21a71Sskrll # undef EXIT_FAILURE
654*f9f21a71Sskrll # define EXIT_FAILURE 1
655*f9f21a71Sskrll #endif
656*f9f21a71Sskrll 
657*f9f21a71Sskrll 
658*f9f21a71Sskrll #if 0
659*f9f21a71Sskrll /* Terminate the current process with the given return code, without running
660*f9f21a71Sskrll    the 'atexit' handlers.  */
661*f9f21a71Sskrll # if !1
662*f9f21a71Sskrll _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
663*f9f21a71Sskrll # endif
664*f9f21a71Sskrll _GL_CXXALIAS_SYS (_Exit, void, (int status));
665*f9f21a71Sskrll _GL_CXXALIASWARN (_Exit);
666*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
667*f9f21a71Sskrll # undef _Exit
668*f9f21a71Sskrll # if HAVE_RAW_DECL__EXIT
669*f9f21a71Sskrll _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
670*f9f21a71Sskrll                  "use gnulib module _Exit for portability");
671*f9f21a71Sskrll # endif
672*f9f21a71Sskrll #endif
673*f9f21a71Sskrll 
674*f9f21a71Sskrll 
675*f9f21a71Sskrll #if 0
676*f9f21a71Sskrll /* Parse a signed decimal integer.
677*f9f21a71Sskrll    Returns the value of the integer.  Errors are not detected.  */
678*f9f21a71Sskrll # if !1
679*f9f21a71Sskrll _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
680*f9f21a71Sskrll                                     _GL_ATTRIBUTE_PURE
681*f9f21a71Sskrll                                     _GL_ARG_NONNULL ((1)));
682*f9f21a71Sskrll # endif
683*f9f21a71Sskrll _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
684*f9f21a71Sskrll _GL_CXXALIASWARN (atoll);
685*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
686*f9f21a71Sskrll # undef atoll
687*f9f21a71Sskrll # if HAVE_RAW_DECL_ATOLL
688*f9f21a71Sskrll _GL_WARN_ON_USE (atoll, "atoll is unportable - "
689*f9f21a71Sskrll                  "use gnulib module atoll for portability");
690*f9f21a71Sskrll # endif
691*f9f21a71Sskrll #endif
692*f9f21a71Sskrll 
693*f9f21a71Sskrll #if 0
694*f9f21a71Sskrll # if 0
695*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
696*f9f21a71Sskrll #   undef calloc
697*f9f21a71Sskrll #   define calloc rpl_calloc
698*f9f21a71Sskrll #  endif
699*f9f21a71Sskrll _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
700*f9f21a71Sskrll _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
701*f9f21a71Sskrll # else
702*f9f21a71Sskrll _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
703*f9f21a71Sskrll # endif
704*f9f21a71Sskrll # if __GLIBC__ >= 2
705*f9f21a71Sskrll _GL_CXXALIASWARN (calloc);
706*f9f21a71Sskrll # endif
707*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
708*f9f21a71Sskrll # undef calloc
709*f9f21a71Sskrll /* Assume calloc is always declared.  */
710*f9f21a71Sskrll _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
711*f9f21a71Sskrll                  "use gnulib module calloc-posix for portability");
712*f9f21a71Sskrll #endif
713*f9f21a71Sskrll 
714*f9f21a71Sskrll #if 1
715*f9f21a71Sskrll # if 0
716*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
717*f9f21a71Sskrll #   define canonicalize_file_name rpl_canonicalize_file_name
718*f9f21a71Sskrll #  endif
719*f9f21a71Sskrll _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
720*f9f21a71Sskrll                                                   _GL_ARG_NONNULL ((1)));
721*f9f21a71Sskrll _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
722*f9f21a71Sskrll # else
723*f9f21a71Sskrll #  if !0
724*f9f21a71Sskrll _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
725*f9f21a71Sskrll                                                   _GL_ARG_NONNULL ((1)));
726*f9f21a71Sskrll #  endif
727*f9f21a71Sskrll _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
728*f9f21a71Sskrll # endif
729*f9f21a71Sskrll # ifndef GNULIB_defined_canonicalize_file_name
730*f9f21a71Sskrll #  define GNULIB_defined_canonicalize_file_name \
731*f9f21a71Sskrll      (!0 || 0)
732*f9f21a71Sskrll # endif
733*f9f21a71Sskrll _GL_CXXALIASWARN (canonicalize_file_name);
734*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
735*f9f21a71Sskrll # undef canonicalize_file_name
736*f9f21a71Sskrll # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
737*f9f21a71Sskrll _GL_WARN_ON_USE (canonicalize_file_name,
738*f9f21a71Sskrll                  "canonicalize_file_name is unportable - "
739*f9f21a71Sskrll                  "use gnulib module canonicalize-lgpl for portability");
740*f9f21a71Sskrll # endif
741*f9f21a71Sskrll #endif
742*f9f21a71Sskrll 
743*f9f21a71Sskrll #if 0
744*f9f21a71Sskrll /* Store max(NELEM,3) load average numbers in LOADAVG[].
745*f9f21a71Sskrll    The three numbers are the load average of the last 1 minute, the last 5
746*f9f21a71Sskrll    minutes, and the last 15 minutes, respectively.
747*f9f21a71Sskrll    LOADAVG is an array of NELEM numbers.  */
748*f9f21a71Sskrll # if !1
749*f9f21a71Sskrll _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
750*f9f21a71Sskrll                                    _GL_ARG_NONNULL ((1)));
751*f9f21a71Sskrll # endif
752*f9f21a71Sskrll _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
753*f9f21a71Sskrll _GL_CXXALIASWARN (getloadavg);
754*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
755*f9f21a71Sskrll # undef getloadavg
756*f9f21a71Sskrll # if HAVE_RAW_DECL_GETLOADAVG
757*f9f21a71Sskrll _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
758*f9f21a71Sskrll                  "use gnulib module getloadavg for portability");
759*f9f21a71Sskrll # endif
760*f9f21a71Sskrll #endif
761*f9f21a71Sskrll 
762*f9f21a71Sskrll #if 0
763*f9f21a71Sskrll /* Assuming *OPTIONP is a comma separated list of elements of the form
764*f9f21a71Sskrll    "token" or "token=value", getsubopt parses the first of these elements.
765*f9f21a71Sskrll    If the first element refers to a "token" that is member of the given
766*f9f21a71Sskrll    NULL-terminated array of tokens:
767*f9f21a71Sskrll      - It replaces the comma with a NUL byte, updates *OPTIONP to point past
768*f9f21a71Sskrll        the first option and the comma, sets *VALUEP to the value of the
769*f9f21a71Sskrll        element (or NULL if it doesn't contain an "=" sign),
770*f9f21a71Sskrll      - It returns the index of the "token" in the given array of tokens.
771*f9f21a71Sskrll    Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
772*f9f21a71Sskrll    For more details see the POSIX specification.
773*f9f21a71Sskrll    https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
774*f9f21a71Sskrll # if !1
775*f9f21a71Sskrll _GL_FUNCDECL_SYS (getsubopt, int,
776*f9f21a71Sskrll                   (char **optionp, char *const *tokens, char **valuep)
777*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1, 2, 3)));
778*f9f21a71Sskrll # endif
779*f9f21a71Sskrll _GL_CXXALIAS_SYS (getsubopt, int,
780*f9f21a71Sskrll                   (char **optionp, char *const *tokens, char **valuep));
781*f9f21a71Sskrll _GL_CXXALIASWARN (getsubopt);
782*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
783*f9f21a71Sskrll # undef getsubopt
784*f9f21a71Sskrll # if HAVE_RAW_DECL_GETSUBOPT
785*f9f21a71Sskrll _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
786*f9f21a71Sskrll                  "use gnulib module getsubopt for portability");
787*f9f21a71Sskrll # endif
788*f9f21a71Sskrll #endif
789*f9f21a71Sskrll 
790*f9f21a71Sskrll #if 0
791*f9f21a71Sskrll /* Change the ownership and access permission of the slave side of the
792*f9f21a71Sskrll    pseudo-terminal whose master side is specified by FD.  */
793*f9f21a71Sskrll # if !1
794*f9f21a71Sskrll _GL_FUNCDECL_SYS (grantpt, int, (int fd));
795*f9f21a71Sskrll # endif
796*f9f21a71Sskrll _GL_CXXALIAS_SYS (grantpt, int, (int fd));
797*f9f21a71Sskrll _GL_CXXALIASWARN (grantpt);
798*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
799*f9f21a71Sskrll # undef grantpt
800*f9f21a71Sskrll # if HAVE_RAW_DECL_GRANTPT
801*f9f21a71Sskrll _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
802*f9f21a71Sskrll                  "use gnulib module grantpt for portability");
803*f9f21a71Sskrll # endif
804*f9f21a71Sskrll #endif
805*f9f21a71Sskrll 
806*f9f21a71Sskrll /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
807*f9f21a71Sskrll    rely on GNU or POSIX semantics for malloc and realloc (for example,
808*f9f21a71Sskrll    by never specifying a zero size), so it does not need malloc or
809*f9f21a71Sskrll    realloc to be redefined.  */
810*f9f21a71Sskrll #if 1
811*f9f21a71Sskrll # if 0
812*f9f21a71Sskrll #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
813*f9f21a71Sskrll         || _GL_USE_STDLIB_ALLOC)
814*f9f21a71Sskrll #   undef malloc
815*f9f21a71Sskrll #   define malloc rpl_malloc
816*f9f21a71Sskrll #  endif
817*f9f21a71Sskrll _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
818*f9f21a71Sskrll _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
819*f9f21a71Sskrll # else
820*f9f21a71Sskrll _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
821*f9f21a71Sskrll # endif
822*f9f21a71Sskrll # if __GLIBC__ >= 2
823*f9f21a71Sskrll _GL_CXXALIASWARN (malloc);
824*f9f21a71Sskrll # endif
825*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
826*f9f21a71Sskrll # undef malloc
827*f9f21a71Sskrll /* Assume malloc is always declared.  */
828*f9f21a71Sskrll _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
829*f9f21a71Sskrll                  "use gnulib module malloc-posix for portability");
830*f9f21a71Sskrll #endif
831*f9f21a71Sskrll 
832*f9f21a71Sskrll /* Convert a multibyte character to a wide character.  */
833*f9f21a71Sskrll #if 1
834*f9f21a71Sskrll # if 0
835*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
836*f9f21a71Sskrll #   undef mbtowc
837*f9f21a71Sskrll #   define mbtowc rpl_mbtowc
838*f9f21a71Sskrll #  endif
839*f9f21a71Sskrll _GL_FUNCDECL_RPL (mbtowc, int,
840*f9f21a71Sskrll                   (wchar_t *restrict pwc, const char *restrict s, size_t n));
841*f9f21a71Sskrll _GL_CXXALIAS_RPL (mbtowc, int,
842*f9f21a71Sskrll                   (wchar_t *restrict pwc, const char *restrict s, size_t n));
843*f9f21a71Sskrll # else
844*f9f21a71Sskrll #  if !1
845*f9f21a71Sskrll _GL_FUNCDECL_SYS (mbtowc, int,
846*f9f21a71Sskrll                   (wchar_t *restrict pwc, const char *restrict s, size_t n));
847*f9f21a71Sskrll #  endif
848*f9f21a71Sskrll _GL_CXXALIAS_SYS (mbtowc, int,
849*f9f21a71Sskrll                   (wchar_t *restrict pwc, const char *restrict s, size_t n));
850*f9f21a71Sskrll # endif
851*f9f21a71Sskrll # if __GLIBC__ >= 2
852*f9f21a71Sskrll _GL_CXXALIASWARN (mbtowc);
853*f9f21a71Sskrll # endif
854*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
855*f9f21a71Sskrll # undef mbtowc
856*f9f21a71Sskrll # if HAVE_RAW_DECL_MBTOWC
857*f9f21a71Sskrll _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
858*f9f21a71Sskrll                  "use gnulib module mbtowc for portability");
859*f9f21a71Sskrll # endif
860*f9f21a71Sskrll #endif
861*f9f21a71Sskrll 
862*f9f21a71Sskrll #if 1
863*f9f21a71Sskrll /* Create a unique temporary directory from TEMPLATE.
864*f9f21a71Sskrll    The last six characters of TEMPLATE must be "XXXXXX";
865*f9f21a71Sskrll    they are replaced with a string that makes the directory name unique.
866*f9f21a71Sskrll    Returns TEMPLATE, or a null pointer if it cannot get a unique name.
867*f9f21a71Sskrll    The directory is created mode 700.  */
868*f9f21a71Sskrll # if !1
869*f9f21a71Sskrll _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
870*f9f21a71Sskrll # endif
871*f9f21a71Sskrll _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
872*f9f21a71Sskrll _GL_CXXALIASWARN (mkdtemp);
873*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
874*f9f21a71Sskrll # undef mkdtemp
875*f9f21a71Sskrll # if HAVE_RAW_DECL_MKDTEMP
876*f9f21a71Sskrll _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
877*f9f21a71Sskrll                  "use gnulib module mkdtemp for portability");
878*f9f21a71Sskrll # endif
879*f9f21a71Sskrll #endif
880*f9f21a71Sskrll 
881*f9f21a71Sskrll #if 1
882*f9f21a71Sskrll /* Create a unique temporary file from TEMPLATE.
883*f9f21a71Sskrll    The last six characters of TEMPLATE must be "XXXXXX";
884*f9f21a71Sskrll    they are replaced with a string that makes the file name unique.
885*f9f21a71Sskrll    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
886*f9f21a71Sskrll    and O_TEXT, O_BINARY (defined in "binary-io.h").
887*f9f21a71Sskrll    The file is then created, with the specified flags, ensuring it didn't exist
888*f9f21a71Sskrll    before.
889*f9f21a71Sskrll    The file is created read-write (mask at least 0600 & ~umask), but it may be
890*f9f21a71Sskrll    world-readable and world-writable (mask 0666 & ~umask), depending on the
891*f9f21a71Sskrll    implementation.
892*f9f21a71Sskrll    Returns the open file descriptor if successful, otherwise -1 and errno
893*f9f21a71Sskrll    set.  */
894*f9f21a71Sskrll # if !1
895*f9f21a71Sskrll _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
896*f9f21a71Sskrll                                  _GL_ARG_NONNULL ((1)));
897*f9f21a71Sskrll # endif
898*f9f21a71Sskrll _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
899*f9f21a71Sskrll _GL_CXXALIASWARN (mkostemp);
900*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
901*f9f21a71Sskrll # undef mkostemp
902*f9f21a71Sskrll # if HAVE_RAW_DECL_MKOSTEMP
903*f9f21a71Sskrll _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
904*f9f21a71Sskrll                  "use gnulib module mkostemp for portability");
905*f9f21a71Sskrll # endif
906*f9f21a71Sskrll #endif
907*f9f21a71Sskrll 
908*f9f21a71Sskrll #if 0
909*f9f21a71Sskrll /* Create a unique temporary file from TEMPLATE.
910*f9f21a71Sskrll    The last six characters of TEMPLATE before a suffix of length
911*f9f21a71Sskrll    SUFFIXLEN must be "XXXXXX";
912*f9f21a71Sskrll    they are replaced with a string that makes the file name unique.
913*f9f21a71Sskrll    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
914*f9f21a71Sskrll    and O_TEXT, O_BINARY (defined in "binary-io.h").
915*f9f21a71Sskrll    The file is then created, with the specified flags, ensuring it didn't exist
916*f9f21a71Sskrll    before.
917*f9f21a71Sskrll    The file is created read-write (mask at least 0600 & ~umask), but it may be
918*f9f21a71Sskrll    world-readable and world-writable (mask 0666 & ~umask), depending on the
919*f9f21a71Sskrll    implementation.
920*f9f21a71Sskrll    Returns the open file descriptor if successful, otherwise -1 and errno
921*f9f21a71Sskrll    set.  */
922*f9f21a71Sskrll # if !1
923*f9f21a71Sskrll _GL_FUNCDECL_SYS (mkostemps, int,
924*f9f21a71Sskrll                   (char * /*template*/, int /*suffixlen*/, int /*flags*/)
925*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
926*f9f21a71Sskrll # endif
927*f9f21a71Sskrll _GL_CXXALIAS_SYS (mkostemps, int,
928*f9f21a71Sskrll                   (char * /*template*/, int /*suffixlen*/, int /*flags*/));
929*f9f21a71Sskrll _GL_CXXALIASWARN (mkostemps);
930*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
931*f9f21a71Sskrll # undef mkostemps
932*f9f21a71Sskrll # if HAVE_RAW_DECL_MKOSTEMPS
933*f9f21a71Sskrll _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
934*f9f21a71Sskrll                  "use gnulib module mkostemps for portability");
935*f9f21a71Sskrll # endif
936*f9f21a71Sskrll #endif
937*f9f21a71Sskrll 
938*f9f21a71Sskrll #if 0
939*f9f21a71Sskrll /* Create a unique temporary file from TEMPLATE.
940*f9f21a71Sskrll    The last six characters of TEMPLATE must be "XXXXXX";
941*f9f21a71Sskrll    they are replaced with a string that makes the file name unique.
942*f9f21a71Sskrll    The file is then created, ensuring it didn't exist before.
943*f9f21a71Sskrll    The file is created read-write (mask at least 0600 & ~umask), but it may be
944*f9f21a71Sskrll    world-readable and world-writable (mask 0666 & ~umask), depending on the
945*f9f21a71Sskrll    implementation.
946*f9f21a71Sskrll    Returns the open file descriptor if successful, otherwise -1 and errno
947*f9f21a71Sskrll    set.  */
948*f9f21a71Sskrll # if 0
949*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
950*f9f21a71Sskrll #   define mkstemp rpl_mkstemp
951*f9f21a71Sskrll #  endif
952*f9f21a71Sskrll _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
953*f9f21a71Sskrll _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
954*f9f21a71Sskrll # else
955*f9f21a71Sskrll #  if ! 1
956*f9f21a71Sskrll _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
957*f9f21a71Sskrll #  endif
958*f9f21a71Sskrll _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
959*f9f21a71Sskrll # endif
960*f9f21a71Sskrll _GL_CXXALIASWARN (mkstemp);
961*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
962*f9f21a71Sskrll # undef mkstemp
963*f9f21a71Sskrll # if HAVE_RAW_DECL_MKSTEMP
964*f9f21a71Sskrll _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
965*f9f21a71Sskrll                  "use gnulib module mkstemp for portability");
966*f9f21a71Sskrll # endif
967*f9f21a71Sskrll #endif
968*f9f21a71Sskrll 
969*f9f21a71Sskrll #if 0
970*f9f21a71Sskrll /* Create a unique temporary file from TEMPLATE.
971*f9f21a71Sskrll    The last six characters of TEMPLATE prior to a suffix of length
972*f9f21a71Sskrll    SUFFIXLEN must be "XXXXXX";
973*f9f21a71Sskrll    they are replaced with a string that makes the file name unique.
974*f9f21a71Sskrll    The file is then created, ensuring it didn't exist before.
975*f9f21a71Sskrll    The file is created read-write (mask at least 0600 & ~umask), but it may be
976*f9f21a71Sskrll    world-readable and world-writable (mask 0666 & ~umask), depending on the
977*f9f21a71Sskrll    implementation.
978*f9f21a71Sskrll    Returns the open file descriptor if successful, otherwise -1 and errno
979*f9f21a71Sskrll    set.  */
980*f9f21a71Sskrll # if !1
981*f9f21a71Sskrll _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
982*f9f21a71Sskrll                                  _GL_ARG_NONNULL ((1)));
983*f9f21a71Sskrll # endif
984*f9f21a71Sskrll _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
985*f9f21a71Sskrll _GL_CXXALIASWARN (mkstemps);
986*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
987*f9f21a71Sskrll # undef mkstemps
988*f9f21a71Sskrll # if HAVE_RAW_DECL_MKSTEMPS
989*f9f21a71Sskrll _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
990*f9f21a71Sskrll                  "use gnulib module mkstemps for portability");
991*f9f21a71Sskrll # endif
992*f9f21a71Sskrll #endif
993*f9f21a71Sskrll 
994*f9f21a71Sskrll #if 0
995*f9f21a71Sskrll /* Return an FD open to the master side of a pseudo-terminal.  Flags should
996*f9f21a71Sskrll    include O_RDWR, and may also include O_NOCTTY.  */
997*f9f21a71Sskrll # if !1
998*f9f21a71Sskrll _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
999*f9f21a71Sskrll # endif
1000*f9f21a71Sskrll _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
1001*f9f21a71Sskrll _GL_CXXALIASWARN (posix_openpt);
1002*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1003*f9f21a71Sskrll # undef posix_openpt
1004*f9f21a71Sskrll # if HAVE_RAW_DECL_POSIX_OPENPT
1005*f9f21a71Sskrll _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
1006*f9f21a71Sskrll                  "use gnulib module posix_openpt for portability");
1007*f9f21a71Sskrll # endif
1008*f9f21a71Sskrll #endif
1009*f9f21a71Sskrll 
1010*f9f21a71Sskrll #if 0
1011*f9f21a71Sskrll /* Return the pathname of the pseudo-terminal slave associated with
1012*f9f21a71Sskrll    the master FD is open on, or NULL on errors.  */
1013*f9f21a71Sskrll # if 0
1014*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1015*f9f21a71Sskrll #   undef ptsname
1016*f9f21a71Sskrll #   define ptsname rpl_ptsname
1017*f9f21a71Sskrll #  endif
1018*f9f21a71Sskrll _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
1019*f9f21a71Sskrll _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
1020*f9f21a71Sskrll # else
1021*f9f21a71Sskrll #  if !1
1022*f9f21a71Sskrll _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
1023*f9f21a71Sskrll #  endif
1024*f9f21a71Sskrll _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
1025*f9f21a71Sskrll # endif
1026*f9f21a71Sskrll _GL_CXXALIASWARN (ptsname);
1027*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1028*f9f21a71Sskrll # undef ptsname
1029*f9f21a71Sskrll # if HAVE_RAW_DECL_PTSNAME
1030*f9f21a71Sskrll _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
1031*f9f21a71Sskrll                  "use gnulib module ptsname for portability");
1032*f9f21a71Sskrll # endif
1033*f9f21a71Sskrll #endif
1034*f9f21a71Sskrll 
1035*f9f21a71Sskrll #if 0
1036*f9f21a71Sskrll /* Set the pathname of the pseudo-terminal slave associated with
1037*f9f21a71Sskrll    the master FD is open on and return 0, or set errno and return
1038*f9f21a71Sskrll    non-zero on errors.  */
1039*f9f21a71Sskrll # if 0
1040*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1041*f9f21a71Sskrll #   undef ptsname_r
1042*f9f21a71Sskrll #   define ptsname_r rpl_ptsname_r
1043*f9f21a71Sskrll #  endif
1044*f9f21a71Sskrll _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
1045*f9f21a71Sskrll _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
1046*f9f21a71Sskrll # else
1047*f9f21a71Sskrll #  if !1
1048*f9f21a71Sskrll _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1049*f9f21a71Sskrll #  endif
1050*f9f21a71Sskrll _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1051*f9f21a71Sskrll # endif
1052*f9f21a71Sskrll # ifndef GNULIB_defined_ptsname_r
1053*f9f21a71Sskrll #  define GNULIB_defined_ptsname_r (!1 || 0)
1054*f9f21a71Sskrll # endif
1055*f9f21a71Sskrll _GL_CXXALIASWARN (ptsname_r);
1056*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1057*f9f21a71Sskrll # undef ptsname_r
1058*f9f21a71Sskrll # if HAVE_RAW_DECL_PTSNAME_R
1059*f9f21a71Sskrll _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
1060*f9f21a71Sskrll                  "use gnulib module ptsname_r for portability");
1061*f9f21a71Sskrll # endif
1062*f9f21a71Sskrll #endif
1063*f9f21a71Sskrll 
1064*f9f21a71Sskrll #if 0
1065*f9f21a71Sskrll # if 0
1066*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1067*f9f21a71Sskrll #   undef putenv
1068*f9f21a71Sskrll #   define putenv rpl_putenv
1069*f9f21a71Sskrll #  endif
1070*f9f21a71Sskrll _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
1071*f9f21a71Sskrll _GL_CXXALIAS_RPL (putenv, int, (char *string));
1072*f9f21a71Sskrll # else
1073*f9f21a71Sskrll _GL_CXXALIAS_SYS (putenv, int, (char *string));
1074*f9f21a71Sskrll # endif
1075*f9f21a71Sskrll _GL_CXXALIASWARN (putenv);
1076*f9f21a71Sskrll #endif
1077*f9f21a71Sskrll 
1078*f9f21a71Sskrll #if 0
1079*f9f21a71Sskrll /* Sort an array of NMEMB elements, starting at address BASE, each element
1080*f9f21a71Sskrll    occupying SIZE bytes, in ascending order according to the comparison
1081*f9f21a71Sskrll    function COMPARE.  */
1082*f9f21a71Sskrll # if 0
1083*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1084*f9f21a71Sskrll #   undef qsort_r
1085*f9f21a71Sskrll #   define qsort_r rpl_qsort_r
1086*f9f21a71Sskrll #  endif
1087*f9f21a71Sskrll _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1088*f9f21a71Sskrll                                   int (*compare) (void const *, void const *,
1089*f9f21a71Sskrll                                                   void *),
1090*f9f21a71Sskrll                                   void *arg) _GL_ARG_NONNULL ((1, 4)));
1091*f9f21a71Sskrll _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1092*f9f21a71Sskrll                                   int (*compare) (void const *, void const *,
1093*f9f21a71Sskrll                                                   void *),
1094*f9f21a71Sskrll                                   void *arg));
1095*f9f21a71Sskrll # else
1096*f9f21a71Sskrll #  if !1
1097*f9f21a71Sskrll _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1098*f9f21a71Sskrll                                   int (*compare) (void const *, void const *,
1099*f9f21a71Sskrll                                                   void *),
1100*f9f21a71Sskrll                                   void *arg) _GL_ARG_NONNULL ((1, 4)));
1101*f9f21a71Sskrll #  endif
1102*f9f21a71Sskrll _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1103*f9f21a71Sskrll                                   int (*compare) (void const *, void const *,
1104*f9f21a71Sskrll                                                   void *),
1105*f9f21a71Sskrll                                   void *arg));
1106*f9f21a71Sskrll # endif
1107*f9f21a71Sskrll _GL_CXXALIASWARN (qsort_r);
1108*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1109*f9f21a71Sskrll # undef qsort_r
1110*f9f21a71Sskrll # if HAVE_RAW_DECL_QSORT_R
1111*f9f21a71Sskrll _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
1112*f9f21a71Sskrll                  "use gnulib module qsort_r for portability");
1113*f9f21a71Sskrll # endif
1114*f9f21a71Sskrll #endif
1115*f9f21a71Sskrll 
1116*f9f21a71Sskrll 
1117*f9f21a71Sskrll #if 0
1118*f9f21a71Sskrll # if !1
1119*f9f21a71Sskrll #  ifndef RAND_MAX
1120*f9f21a71Sskrll #   define RAND_MAX 2147483647
1121*f9f21a71Sskrll #  endif
1122*f9f21a71Sskrll # endif
1123*f9f21a71Sskrll #endif
1124*f9f21a71Sskrll 
1125*f9f21a71Sskrll 
1126*f9f21a71Sskrll #if 0
1127*f9f21a71Sskrll # if 0
1128*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1129*f9f21a71Sskrll #   undef random
1130*f9f21a71Sskrll #   define random rpl_random
1131*f9f21a71Sskrll #  endif
1132*f9f21a71Sskrll _GL_FUNCDECL_RPL (random, long, (void));
1133*f9f21a71Sskrll _GL_CXXALIAS_RPL (random, long, (void));
1134*f9f21a71Sskrll # else
1135*f9f21a71Sskrll #  if !1
1136*f9f21a71Sskrll _GL_FUNCDECL_SYS (random, long, (void));
1137*f9f21a71Sskrll #  endif
1138*f9f21a71Sskrll /* Need to cast, because on Haiku, the return type is
1139*f9f21a71Sskrll                                int.  */
1140*f9f21a71Sskrll _GL_CXXALIAS_SYS_CAST (random, long, (void));
1141*f9f21a71Sskrll # endif
1142*f9f21a71Sskrll _GL_CXXALIASWARN (random);
1143*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1144*f9f21a71Sskrll # undef random
1145*f9f21a71Sskrll # if HAVE_RAW_DECL_RANDOM
1146*f9f21a71Sskrll _GL_WARN_ON_USE (random, "random is unportable - "
1147*f9f21a71Sskrll                  "use gnulib module random for portability");
1148*f9f21a71Sskrll # endif
1149*f9f21a71Sskrll #endif
1150*f9f21a71Sskrll 
1151*f9f21a71Sskrll #if 0
1152*f9f21a71Sskrll # if 0
1153*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1154*f9f21a71Sskrll #   undef srandom
1155*f9f21a71Sskrll #   define srandom rpl_srandom
1156*f9f21a71Sskrll #  endif
1157*f9f21a71Sskrll _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
1158*f9f21a71Sskrll _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
1159*f9f21a71Sskrll # else
1160*f9f21a71Sskrll #  if !1
1161*f9f21a71Sskrll _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
1162*f9f21a71Sskrll #  endif
1163*f9f21a71Sskrll /* Need to cast, because on FreeBSD, the first parameter is
1164*f9f21a71Sskrll                                        unsigned long seed.  */
1165*f9f21a71Sskrll _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
1166*f9f21a71Sskrll # endif
1167*f9f21a71Sskrll _GL_CXXALIASWARN (srandom);
1168*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1169*f9f21a71Sskrll # undef srandom
1170*f9f21a71Sskrll # if HAVE_RAW_DECL_SRANDOM
1171*f9f21a71Sskrll _GL_WARN_ON_USE (srandom, "srandom is unportable - "
1172*f9f21a71Sskrll                  "use gnulib module random for portability");
1173*f9f21a71Sskrll # endif
1174*f9f21a71Sskrll #endif
1175*f9f21a71Sskrll 
1176*f9f21a71Sskrll #if 0
1177*f9f21a71Sskrll # if 0
1178*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1179*f9f21a71Sskrll #   undef initstate
1180*f9f21a71Sskrll #   define initstate rpl_initstate
1181*f9f21a71Sskrll #  endif
1182*f9f21a71Sskrll _GL_FUNCDECL_RPL (initstate, char *,
1183*f9f21a71Sskrll                   (unsigned int seed, char *buf, size_t buf_size)
1184*f9f21a71Sskrll                   _GL_ARG_NONNULL ((2)));
1185*f9f21a71Sskrll _GL_CXXALIAS_RPL (initstate, char *,
1186*f9f21a71Sskrll                   (unsigned int seed, char *buf, size_t buf_size));
1187*f9f21a71Sskrll # else
1188*f9f21a71Sskrll #  if !1 || !1
1189*f9f21a71Sskrll _GL_FUNCDECL_SYS (initstate, char *,
1190*f9f21a71Sskrll                   (unsigned int seed, char *buf, size_t buf_size)
1191*f9f21a71Sskrll                   _GL_ARG_NONNULL ((2)));
1192*f9f21a71Sskrll #  endif
1193*f9f21a71Sskrll /* Need to cast, because on FreeBSD, the first parameter is
1194*f9f21a71Sskrll                         unsigned long seed.  */
1195*f9f21a71Sskrll _GL_CXXALIAS_SYS_CAST (initstate, char *,
1196*f9f21a71Sskrll                        (unsigned int seed, char *buf, size_t buf_size));
1197*f9f21a71Sskrll # endif
1198*f9f21a71Sskrll _GL_CXXALIASWARN (initstate);
1199*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1200*f9f21a71Sskrll # undef initstate
1201*f9f21a71Sskrll # if HAVE_RAW_DECL_INITSTATE
1202*f9f21a71Sskrll _GL_WARN_ON_USE (initstate, "initstate is unportable - "
1203*f9f21a71Sskrll                  "use gnulib module random for portability");
1204*f9f21a71Sskrll # endif
1205*f9f21a71Sskrll #endif
1206*f9f21a71Sskrll 
1207*f9f21a71Sskrll #if 0
1208*f9f21a71Sskrll # if 0
1209*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1210*f9f21a71Sskrll #   undef setstate
1211*f9f21a71Sskrll #   define setstate rpl_setstate
1212*f9f21a71Sskrll #  endif
1213*f9f21a71Sskrll _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1214*f9f21a71Sskrll _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
1215*f9f21a71Sskrll # else
1216*f9f21a71Sskrll #  if !1 || !1
1217*f9f21a71Sskrll _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1218*f9f21a71Sskrll #  endif
1219*f9f21a71Sskrll /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
1220*f9f21a71Sskrll    is                                     const char *arg_state.  */
1221*f9f21a71Sskrll _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
1222*f9f21a71Sskrll # endif
1223*f9f21a71Sskrll _GL_CXXALIASWARN (setstate);
1224*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1225*f9f21a71Sskrll # undef setstate
1226*f9f21a71Sskrll # if HAVE_RAW_DECL_SETSTATE
1227*f9f21a71Sskrll _GL_WARN_ON_USE (setstate, "setstate is unportable - "
1228*f9f21a71Sskrll                  "use gnulib module random for portability");
1229*f9f21a71Sskrll # endif
1230*f9f21a71Sskrll #endif
1231*f9f21a71Sskrll 
1232*f9f21a71Sskrll 
1233*f9f21a71Sskrll #if 0
1234*f9f21a71Sskrll # if 0
1235*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1236*f9f21a71Sskrll #   undef random_r
1237*f9f21a71Sskrll #   define random_r rpl_random_r
1238*f9f21a71Sskrll #  endif
1239*f9f21a71Sskrll _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
1240*f9f21a71Sskrll                                  _GL_ARG_NONNULL ((1, 2)));
1241*f9f21a71Sskrll _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1242*f9f21a71Sskrll # else
1243*f9f21a71Sskrll #  if !1
1244*f9f21a71Sskrll _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
1245*f9f21a71Sskrll                                  _GL_ARG_NONNULL ((1, 2)));
1246*f9f21a71Sskrll #  endif
1247*f9f21a71Sskrll _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
1248*f9f21a71Sskrll # endif
1249*f9f21a71Sskrll _GL_CXXALIASWARN (random_r);
1250*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1251*f9f21a71Sskrll # undef random_r
1252*f9f21a71Sskrll # if HAVE_RAW_DECL_RANDOM_R
1253*f9f21a71Sskrll _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1254*f9f21a71Sskrll                  "use gnulib module random_r for portability");
1255*f9f21a71Sskrll # endif
1256*f9f21a71Sskrll #endif
1257*f9f21a71Sskrll 
1258*f9f21a71Sskrll #if 0
1259*f9f21a71Sskrll # if 0
1260*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1261*f9f21a71Sskrll #   undef srandom_r
1262*f9f21a71Sskrll #   define srandom_r rpl_srandom_r
1263*f9f21a71Sskrll #  endif
1264*f9f21a71Sskrll _GL_FUNCDECL_RPL (srandom_r, int,
1265*f9f21a71Sskrll                   (unsigned int seed, struct random_data *rand_state)
1266*f9f21a71Sskrll                   _GL_ARG_NONNULL ((2)));
1267*f9f21a71Sskrll _GL_CXXALIAS_RPL (srandom_r, int,
1268*f9f21a71Sskrll                   (unsigned int seed, struct random_data *rand_state));
1269*f9f21a71Sskrll # else
1270*f9f21a71Sskrll #  if !1
1271*f9f21a71Sskrll _GL_FUNCDECL_SYS (srandom_r, int,
1272*f9f21a71Sskrll                   (unsigned int seed, struct random_data *rand_state)
1273*f9f21a71Sskrll                   _GL_ARG_NONNULL ((2)));
1274*f9f21a71Sskrll #  endif
1275*f9f21a71Sskrll _GL_CXXALIAS_SYS (srandom_r, int,
1276*f9f21a71Sskrll                   (unsigned int seed, struct random_data *rand_state));
1277*f9f21a71Sskrll # endif
1278*f9f21a71Sskrll _GL_CXXALIASWARN (srandom_r);
1279*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1280*f9f21a71Sskrll # undef srandom_r
1281*f9f21a71Sskrll # if HAVE_RAW_DECL_SRANDOM_R
1282*f9f21a71Sskrll _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1283*f9f21a71Sskrll                  "use gnulib module random_r for portability");
1284*f9f21a71Sskrll # endif
1285*f9f21a71Sskrll #endif
1286*f9f21a71Sskrll 
1287*f9f21a71Sskrll #if 0
1288*f9f21a71Sskrll # if 0
1289*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1290*f9f21a71Sskrll #   undef initstate_r
1291*f9f21a71Sskrll #   define initstate_r rpl_initstate_r
1292*f9f21a71Sskrll #  endif
1293*f9f21a71Sskrll _GL_FUNCDECL_RPL (initstate_r, int,
1294*f9f21a71Sskrll                   (unsigned int seed, char *buf, size_t buf_size,
1295*f9f21a71Sskrll                    struct random_data *rand_state)
1296*f9f21a71Sskrll                   _GL_ARG_NONNULL ((2, 4)));
1297*f9f21a71Sskrll _GL_CXXALIAS_RPL (initstate_r, int,
1298*f9f21a71Sskrll                   (unsigned int seed, char *buf, size_t buf_size,
1299*f9f21a71Sskrll                    struct random_data *rand_state));
1300*f9f21a71Sskrll # else
1301*f9f21a71Sskrll #  if !1
1302*f9f21a71Sskrll _GL_FUNCDECL_SYS (initstate_r, int,
1303*f9f21a71Sskrll                   (unsigned int seed, char *buf, size_t buf_size,
1304*f9f21a71Sskrll                    struct random_data *rand_state)
1305*f9f21a71Sskrll                   _GL_ARG_NONNULL ((2, 4)));
1306*f9f21a71Sskrll #  endif
1307*f9f21a71Sskrll /* Need to cast, because on Haiku, the third parameter is
1308*f9f21a71Sskrll                                                      unsigned long buf_size.  */
1309*f9f21a71Sskrll _GL_CXXALIAS_SYS_CAST (initstate_r, int,
1310*f9f21a71Sskrll                        (unsigned int seed, char *buf, size_t buf_size,
1311*f9f21a71Sskrll                         struct random_data *rand_state));
1312*f9f21a71Sskrll # endif
1313*f9f21a71Sskrll _GL_CXXALIASWARN (initstate_r);
1314*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1315*f9f21a71Sskrll # undef initstate_r
1316*f9f21a71Sskrll # if HAVE_RAW_DECL_INITSTATE_R
1317*f9f21a71Sskrll _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1318*f9f21a71Sskrll                  "use gnulib module random_r for portability");
1319*f9f21a71Sskrll # endif
1320*f9f21a71Sskrll #endif
1321*f9f21a71Sskrll 
1322*f9f21a71Sskrll #if 0
1323*f9f21a71Sskrll # if 0
1324*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1325*f9f21a71Sskrll #   undef setstate_r
1326*f9f21a71Sskrll #   define setstate_r rpl_setstate_r
1327*f9f21a71Sskrll #  endif
1328*f9f21a71Sskrll _GL_FUNCDECL_RPL (setstate_r, int,
1329*f9f21a71Sskrll                   (char *arg_state, struct random_data *rand_state)
1330*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1, 2)));
1331*f9f21a71Sskrll _GL_CXXALIAS_RPL (setstate_r, int,
1332*f9f21a71Sskrll                   (char *arg_state, struct random_data *rand_state));
1333*f9f21a71Sskrll # else
1334*f9f21a71Sskrll #  if !1
1335*f9f21a71Sskrll _GL_FUNCDECL_SYS (setstate_r, int,
1336*f9f21a71Sskrll                   (char *arg_state, struct random_data *rand_state)
1337*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1, 2)));
1338*f9f21a71Sskrll #  endif
1339*f9f21a71Sskrll /* Need to cast, because on Haiku, the first parameter is
1340*f9f21a71Sskrll                         void *arg_state.  */
1341*f9f21a71Sskrll _GL_CXXALIAS_SYS_CAST (setstate_r, int,
1342*f9f21a71Sskrll                        (char *arg_state, struct random_data *rand_state));
1343*f9f21a71Sskrll # endif
1344*f9f21a71Sskrll _GL_CXXALIASWARN (setstate_r);
1345*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1346*f9f21a71Sskrll # undef setstate_r
1347*f9f21a71Sskrll # if HAVE_RAW_DECL_SETSTATE_R
1348*f9f21a71Sskrll _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1349*f9f21a71Sskrll                  "use gnulib module random_r for portability");
1350*f9f21a71Sskrll # endif
1351*f9f21a71Sskrll #endif
1352*f9f21a71Sskrll 
1353*f9f21a71Sskrll 
1354*f9f21a71Sskrll #if 1
1355*f9f21a71Sskrll # if 0
1356*f9f21a71Sskrll #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1357*f9f21a71Sskrll         || _GL_USE_STDLIB_ALLOC)
1358*f9f21a71Sskrll #   undef realloc
1359*f9f21a71Sskrll #   define realloc rpl_realloc
1360*f9f21a71Sskrll #  endif
1361*f9f21a71Sskrll _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
1362*f9f21a71Sskrll _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1363*f9f21a71Sskrll # else
1364*f9f21a71Sskrll _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1365*f9f21a71Sskrll # endif
1366*f9f21a71Sskrll # if __GLIBC__ >= 2
1367*f9f21a71Sskrll _GL_CXXALIASWARN (realloc);
1368*f9f21a71Sskrll # endif
1369*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1370*f9f21a71Sskrll # undef realloc
1371*f9f21a71Sskrll /* Assume realloc is always declared.  */
1372*f9f21a71Sskrll _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1373*f9f21a71Sskrll                  "use gnulib module realloc-posix for portability");
1374*f9f21a71Sskrll #endif
1375*f9f21a71Sskrll 
1376*f9f21a71Sskrll 
1377*f9f21a71Sskrll #if 0
1378*f9f21a71Sskrll # if ! 1
1379*f9f21a71Sskrll _GL_FUNCDECL_SYS (reallocarray, void *,
1380*f9f21a71Sskrll                   (void *ptr, size_t nmemb, size_t size));
1381*f9f21a71Sskrll # endif
1382*f9f21a71Sskrll _GL_CXXALIAS_SYS (reallocarray, void *,
1383*f9f21a71Sskrll                   (void *ptr, size_t nmemb, size_t size));
1384*f9f21a71Sskrll _GL_CXXALIASWARN (reallocarray);
1385*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1386*f9f21a71Sskrll # undef reallocarray
1387*f9f21a71Sskrll # if HAVE_RAW_DECL_REALLOCARRAY
1388*f9f21a71Sskrll _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1389*f9f21a71Sskrll                  "use gnulib module reallocarray for portability");
1390*f9f21a71Sskrll # endif
1391*f9f21a71Sskrll #endif
1392*f9f21a71Sskrll 
1393*f9f21a71Sskrll #if 1
1394*f9f21a71Sskrll # if 1
1395*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1396*f9f21a71Sskrll #   define realpath rpl_realpath
1397*f9f21a71Sskrll #  endif
1398*f9f21a71Sskrll _GL_FUNCDECL_RPL (realpath, char *,
1399*f9f21a71Sskrll                   (const char *restrict name, char *restrict resolved)
1400*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1401*f9f21a71Sskrll _GL_CXXALIAS_RPL (realpath, char *,
1402*f9f21a71Sskrll                   (const char *restrict name, char *restrict resolved));
1403*f9f21a71Sskrll # else
1404*f9f21a71Sskrll #  if !1
1405*f9f21a71Sskrll _GL_FUNCDECL_SYS (realpath, char *,
1406*f9f21a71Sskrll                   (const char *restrict name, char *restrict resolved)
1407*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1408*f9f21a71Sskrll #  endif
1409*f9f21a71Sskrll _GL_CXXALIAS_SYS (realpath, char *,
1410*f9f21a71Sskrll                   (const char *restrict name, char *restrict resolved));
1411*f9f21a71Sskrll # endif
1412*f9f21a71Sskrll _GL_CXXALIASWARN (realpath);
1413*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1414*f9f21a71Sskrll # undef realpath
1415*f9f21a71Sskrll # if HAVE_RAW_DECL_REALPATH
1416*f9f21a71Sskrll _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1417*f9f21a71Sskrll                  "canonicalize or canonicalize-lgpl for portability");
1418*f9f21a71Sskrll # endif
1419*f9f21a71Sskrll #endif
1420*f9f21a71Sskrll 
1421*f9f21a71Sskrll #if 0
1422*f9f21a71Sskrll /* Test a user response to a question.
1423*f9f21a71Sskrll    Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
1424*f9f21a71Sskrll # if !1
1425*f9f21a71Sskrll _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
1426*f9f21a71Sskrll # endif
1427*f9f21a71Sskrll _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1428*f9f21a71Sskrll _GL_CXXALIASWARN (rpmatch);
1429*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1430*f9f21a71Sskrll # undef rpmatch
1431*f9f21a71Sskrll # if HAVE_RAW_DECL_RPMATCH
1432*f9f21a71Sskrll _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1433*f9f21a71Sskrll                  "use gnulib module rpmatch for portability");
1434*f9f21a71Sskrll # endif
1435*f9f21a71Sskrll #endif
1436*f9f21a71Sskrll 
1437*f9f21a71Sskrll #if 0
1438*f9f21a71Sskrll /* Look up NAME in the environment, returning 0 in insecure situations.  */
1439*f9f21a71Sskrll # if !1
1440*f9f21a71Sskrll _GL_FUNCDECL_SYS (secure_getenv, char *,
1441*f9f21a71Sskrll                   (char const *name) _GL_ARG_NONNULL ((1)));
1442*f9f21a71Sskrll # endif
1443*f9f21a71Sskrll _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1444*f9f21a71Sskrll _GL_CXXALIASWARN (secure_getenv);
1445*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1446*f9f21a71Sskrll # undef secure_getenv
1447*f9f21a71Sskrll # if HAVE_RAW_DECL_SECURE_GETENV
1448*f9f21a71Sskrll _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1449*f9f21a71Sskrll                  "use gnulib module secure_getenv for portability");
1450*f9f21a71Sskrll # endif
1451*f9f21a71Sskrll #endif
1452*f9f21a71Sskrll 
1453*f9f21a71Sskrll #if 1
1454*f9f21a71Sskrll /* Set NAME to VALUE in the environment.
1455*f9f21a71Sskrll    If REPLACE is nonzero, overwrite an existing value.  */
1456*f9f21a71Sskrll # if 0
1457*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1458*f9f21a71Sskrll #   undef setenv
1459*f9f21a71Sskrll #   define setenv rpl_setenv
1460*f9f21a71Sskrll #  endif
1461*f9f21a71Sskrll _GL_FUNCDECL_RPL (setenv, int,
1462*f9f21a71Sskrll                   (const char *name, const char *value, int replace)
1463*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1464*f9f21a71Sskrll _GL_CXXALIAS_RPL (setenv, int,
1465*f9f21a71Sskrll                   (const char *name, const char *value, int replace));
1466*f9f21a71Sskrll # else
1467*f9f21a71Sskrll #  if !1
1468*f9f21a71Sskrll _GL_FUNCDECL_SYS (setenv, int,
1469*f9f21a71Sskrll                   (const char *name, const char *value, int replace)
1470*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1471*f9f21a71Sskrll #  endif
1472*f9f21a71Sskrll _GL_CXXALIAS_SYS (setenv, int,
1473*f9f21a71Sskrll                   (const char *name, const char *value, int replace));
1474*f9f21a71Sskrll # endif
1475*f9f21a71Sskrll # if !(0 && !1)
1476*f9f21a71Sskrll _GL_CXXALIASWARN (setenv);
1477*f9f21a71Sskrll # endif
1478*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1479*f9f21a71Sskrll # undef setenv
1480*f9f21a71Sskrll # if HAVE_RAW_DECL_SETENV
1481*f9f21a71Sskrll _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1482*f9f21a71Sskrll                  "use gnulib module setenv for portability");
1483*f9f21a71Sskrll # endif
1484*f9f21a71Sskrll #endif
1485*f9f21a71Sskrll 
1486*f9f21a71Sskrll #if 0
1487*f9f21a71Sskrll  /* Parse a double from STRING, updating ENDP if appropriate.  */
1488*f9f21a71Sskrll # if 0
1489*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1490*f9f21a71Sskrll #   define strtod rpl_strtod
1491*f9f21a71Sskrll #  endif
1492*f9f21a71Sskrll #  define GNULIB_defined_strtod_function 1
1493*f9f21a71Sskrll _GL_FUNCDECL_RPL (strtod, double,
1494*f9f21a71Sskrll                   (const char *restrict str, char **restrict endp)
1495*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1496*f9f21a71Sskrll _GL_CXXALIAS_RPL (strtod, double,
1497*f9f21a71Sskrll                   (const char *restrict str, char **restrict endp));
1498*f9f21a71Sskrll # else
1499*f9f21a71Sskrll #  if !1
1500*f9f21a71Sskrll _GL_FUNCDECL_SYS (strtod, double,
1501*f9f21a71Sskrll                   (const char *restrict str, char **restrict endp)
1502*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1503*f9f21a71Sskrll #  endif
1504*f9f21a71Sskrll _GL_CXXALIAS_SYS (strtod, double,
1505*f9f21a71Sskrll                   (const char *restrict str, char **restrict endp));
1506*f9f21a71Sskrll # endif
1507*f9f21a71Sskrll # if __GLIBC__ >= 2
1508*f9f21a71Sskrll _GL_CXXALIASWARN (strtod);
1509*f9f21a71Sskrll # endif
1510*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1511*f9f21a71Sskrll # undef strtod
1512*f9f21a71Sskrll # if HAVE_RAW_DECL_STRTOD
1513*f9f21a71Sskrll _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1514*f9f21a71Sskrll                  "use gnulib module strtod for portability");
1515*f9f21a71Sskrll # endif
1516*f9f21a71Sskrll #endif
1517*f9f21a71Sskrll 
1518*f9f21a71Sskrll #if 0
1519*f9f21a71Sskrll  /* Parse a 'long double' from STRING, updating ENDP if appropriate.  */
1520*f9f21a71Sskrll # if 0
1521*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1522*f9f21a71Sskrll #   define strtold rpl_strtold
1523*f9f21a71Sskrll #  endif
1524*f9f21a71Sskrll #  define GNULIB_defined_strtold_function 1
1525*f9f21a71Sskrll _GL_FUNCDECL_RPL (strtold, long double,
1526*f9f21a71Sskrll                   (const char *restrict str, char **restrict endp)
1527*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1528*f9f21a71Sskrll _GL_CXXALIAS_RPL (strtold, long double,
1529*f9f21a71Sskrll                   (const char *restrict str, char **restrict endp));
1530*f9f21a71Sskrll # else
1531*f9f21a71Sskrll #  if !1
1532*f9f21a71Sskrll _GL_FUNCDECL_SYS (strtold, long double,
1533*f9f21a71Sskrll                   (const char *restrict str, char **restrict endp)
1534*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1535*f9f21a71Sskrll #  endif
1536*f9f21a71Sskrll _GL_CXXALIAS_SYS (strtold, long double,
1537*f9f21a71Sskrll                   (const char *restrict str, char **restrict endp));
1538*f9f21a71Sskrll # endif
1539*f9f21a71Sskrll _GL_CXXALIASWARN (strtold);
1540*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1541*f9f21a71Sskrll # undef strtold
1542*f9f21a71Sskrll # if HAVE_RAW_DECL_STRTOLD
1543*f9f21a71Sskrll _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1544*f9f21a71Sskrll                  "use gnulib module strtold for portability");
1545*f9f21a71Sskrll # endif
1546*f9f21a71Sskrll #endif
1547*f9f21a71Sskrll 
1548*f9f21a71Sskrll #if 0
1549*f9f21a71Sskrll /* Parse a signed integer whose textual representation starts at STRING.
1550*f9f21a71Sskrll    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1551*f9f21a71Sskrll    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1552*f9f21a71Sskrll    "0x").
1553*f9f21a71Sskrll    If ENDPTR is not NULL, the address of the first byte after the integer is
1554*f9f21a71Sskrll    stored in *ENDPTR.
1555*f9f21a71Sskrll    Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
1556*f9f21a71Sskrll    to ERANGE.  */
1557*f9f21a71Sskrll # if !1
1558*f9f21a71Sskrll _GL_FUNCDECL_SYS (strtoll, long long,
1559*f9f21a71Sskrll                   (const char *restrict string, char **restrict endptr,
1560*f9f21a71Sskrll                    int base)
1561*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1562*f9f21a71Sskrll # endif
1563*f9f21a71Sskrll _GL_CXXALIAS_SYS (strtoll, long long,
1564*f9f21a71Sskrll                   (const char *restrict string, char **restrict endptr,
1565*f9f21a71Sskrll                    int base));
1566*f9f21a71Sskrll _GL_CXXALIASWARN (strtoll);
1567*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1568*f9f21a71Sskrll # undef strtoll
1569*f9f21a71Sskrll # if HAVE_RAW_DECL_STRTOLL
1570*f9f21a71Sskrll _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1571*f9f21a71Sskrll                  "use gnulib module strtoll for portability");
1572*f9f21a71Sskrll # endif
1573*f9f21a71Sskrll #endif
1574*f9f21a71Sskrll 
1575*f9f21a71Sskrll #if 0
1576*f9f21a71Sskrll /* Parse an unsigned integer whose textual representation starts at STRING.
1577*f9f21a71Sskrll    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1578*f9f21a71Sskrll    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1579*f9f21a71Sskrll    "0x").
1580*f9f21a71Sskrll    If ENDPTR is not NULL, the address of the first byte after the integer is
1581*f9f21a71Sskrll    stored in *ENDPTR.
1582*f9f21a71Sskrll    Upon overflow, the return value is ULLONG_MAX, and errno is set to
1583*f9f21a71Sskrll    ERANGE.  */
1584*f9f21a71Sskrll # if !1
1585*f9f21a71Sskrll _GL_FUNCDECL_SYS (strtoull, unsigned long long,
1586*f9f21a71Sskrll                   (const char *restrict string, char **restrict endptr,
1587*f9f21a71Sskrll                    int base)
1588*f9f21a71Sskrll                   _GL_ARG_NONNULL ((1)));
1589*f9f21a71Sskrll # endif
1590*f9f21a71Sskrll _GL_CXXALIAS_SYS (strtoull, unsigned long long,
1591*f9f21a71Sskrll                   (const char *restrict string, char **restrict endptr,
1592*f9f21a71Sskrll                    int base));
1593*f9f21a71Sskrll _GL_CXXALIASWARN (strtoull);
1594*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1595*f9f21a71Sskrll # undef strtoull
1596*f9f21a71Sskrll # if HAVE_RAW_DECL_STRTOULL
1597*f9f21a71Sskrll _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1598*f9f21a71Sskrll                  "use gnulib module strtoull for portability");
1599*f9f21a71Sskrll # endif
1600*f9f21a71Sskrll #endif
1601*f9f21a71Sskrll 
1602*f9f21a71Sskrll #if 0
1603*f9f21a71Sskrll /* Unlock the slave side of the pseudo-terminal whose master side is specified
1604*f9f21a71Sskrll    by FD, so that it can be opened.  */
1605*f9f21a71Sskrll # if !1
1606*f9f21a71Sskrll _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
1607*f9f21a71Sskrll # endif
1608*f9f21a71Sskrll _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1609*f9f21a71Sskrll _GL_CXXALIASWARN (unlockpt);
1610*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1611*f9f21a71Sskrll # undef unlockpt
1612*f9f21a71Sskrll # if HAVE_RAW_DECL_UNLOCKPT
1613*f9f21a71Sskrll _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1614*f9f21a71Sskrll                  "use gnulib module unlockpt for portability");
1615*f9f21a71Sskrll # endif
1616*f9f21a71Sskrll #endif
1617*f9f21a71Sskrll 
1618*f9f21a71Sskrll #if 1
1619*f9f21a71Sskrll /* Remove the variable NAME from the environment.  */
1620*f9f21a71Sskrll # if 0
1621*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1622*f9f21a71Sskrll #   undef unsetenv
1623*f9f21a71Sskrll #   define unsetenv rpl_unsetenv
1624*f9f21a71Sskrll #  endif
1625*f9f21a71Sskrll _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1626*f9f21a71Sskrll _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1627*f9f21a71Sskrll # else
1628*f9f21a71Sskrll #  if !1
1629*f9f21a71Sskrll _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1630*f9f21a71Sskrll #  endif
1631*f9f21a71Sskrll _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1632*f9f21a71Sskrll # endif
1633*f9f21a71Sskrll # if !(0 && !1)
1634*f9f21a71Sskrll _GL_CXXALIASWARN (unsetenv);
1635*f9f21a71Sskrll # endif
1636*f9f21a71Sskrll #elif defined GNULIB_POSIXCHECK
1637*f9f21a71Sskrll # undef unsetenv
1638*f9f21a71Sskrll # if HAVE_RAW_DECL_UNSETENV
1639*f9f21a71Sskrll _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1640*f9f21a71Sskrll                  "use gnulib module unsetenv for portability");
1641*f9f21a71Sskrll # endif
1642*f9f21a71Sskrll #endif
1643*f9f21a71Sskrll 
1644*f9f21a71Sskrll /* Convert a wide character to a multibyte character.  */
1645*f9f21a71Sskrll #if 0
1646*f9f21a71Sskrll # if 0
1647*f9f21a71Sskrll #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1648*f9f21a71Sskrll #   undef wctomb
1649*f9f21a71Sskrll #   define wctomb rpl_wctomb
1650*f9f21a71Sskrll #  endif
1651*f9f21a71Sskrll _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
1652*f9f21a71Sskrll _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1653*f9f21a71Sskrll # else
1654*f9f21a71Sskrll _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
1655*f9f21a71Sskrll # endif
1656*f9f21a71Sskrll # if __GLIBC__ >= 2
1657*f9f21a71Sskrll _GL_CXXALIASWARN (wctomb);
1658*f9f21a71Sskrll # endif
1659*f9f21a71Sskrll #endif
1660*f9f21a71Sskrll 
1661*f9f21a71Sskrll 
1662*f9f21a71Sskrll #endif /* _GL_STDLIB_H */
1663*f9f21a71Sskrll #endif /* _GL_STDLIB_H */
1664*f9f21a71Sskrll #endif
1665