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