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