1/* This file is automatically generated.  DO NOT EDIT! */
2/* Generated from: NetBSD: mknative-gdb,v 1.12 2020/09/17 16:54:31 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 substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
7
8   Copyright (C) 2009-2020 Free Software Foundation, Inc.
9
10   This program is free software; you can redistribute it and/or modify
11   it under the terms of the GNU General Public License as published by
12   the Free Software Foundation; either version 3, or (at your option)
13   any later version.
14
15   This program 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 General Public License for more details.
19
20   You should have received a copy of the GNU General Public License
21   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
22
23/* Written by Bruno Haible.  */
24
25/*
26 * ISO C 99 <ctype.h> for platforms on which it is incomplete.
27 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html>
28 */
29
30#ifndef _GL_CTYPE_H
31
32#if __GNUC__ >= 3
33#pragma GCC system_header
34#endif
35
36
37/* Include the original <ctype.h>.  */
38/* The include_next requires a split double-inclusion guard.  */
39#include_next <ctype.h>
40
41#ifndef _GL_CTYPE_H
42#define _GL_CTYPE_H
43
44/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
45/* C++ compatible function declaration macros.
46   Copyright (C) 2010-2020 Free Software Foundation, Inc.
47
48   This program is free software: you can redistribute it and/or modify it
49   under the terms of the GNU General Public License as published
50   by the Free Software Foundation; either version 3 of the License, or
51   (at your option) any later version.
52
53   This program is distributed in the hope that it will be useful,
54   but WITHOUT ANY WARRANTY; without even the implied warranty of
55   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
56   General Public License for more details.
57
58   You should have received a copy of the GNU General Public License
59   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
60
61#ifndef _GL_CXXDEFS_H
62#define _GL_CXXDEFS_H
63
64/* Begin/end the GNULIB_NAMESPACE namespace.  */
65#if defined __cplusplus && defined GNULIB_NAMESPACE
66# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
67# define _GL_END_NAMESPACE }
68#else
69# define _GL_BEGIN_NAMESPACE
70# define _GL_END_NAMESPACE
71#endif
72
73/* The three most frequent use cases of these macros are:
74
75   * For providing a substitute for a function that is missing on some
76     platforms, but is declared and works fine on the platforms on which
77     it exists:
78
79       #if @GNULIB_FOO@
80       # if !@HAVE_FOO@
81       _GL_FUNCDECL_SYS (foo, ...);
82       # endif
83       _GL_CXXALIAS_SYS (foo, ...);
84       _GL_CXXALIASWARN (foo);
85       #elif defined GNULIB_POSIXCHECK
86       ...
87       #endif
88
89   * For providing a replacement for a function that exists on all platforms,
90     but is broken/insufficient and needs to be replaced on some platforms:
91
92       #if @GNULIB_FOO@
93       # if @REPLACE_FOO@
94       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
95       #   undef foo
96       #   define foo rpl_foo
97       #  endif
98       _GL_FUNCDECL_RPL (foo, ...);
99       _GL_CXXALIAS_RPL (foo, ...);
100       # else
101       _GL_CXXALIAS_SYS (foo, ...);
102       # endif
103       _GL_CXXALIASWARN (foo);
104       #elif defined GNULIB_POSIXCHECK
105       ...
106       #endif
107
108   * For providing a replacement for a function that exists on some platforms
109     but is broken/insufficient and needs to be replaced on some of them and
110     is additionally either missing or undeclared on some other platforms:
111
112       #if @GNULIB_FOO@
113       # if @REPLACE_FOO@
114       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
115       #   undef foo
116       #   define foo rpl_foo
117       #  endif
118       _GL_FUNCDECL_RPL (foo, ...);
119       _GL_CXXALIAS_RPL (foo, ...);
120       # else
121       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
122       _GL_FUNCDECL_SYS (foo, ...);
123       #  endif
124       _GL_CXXALIAS_SYS (foo, ...);
125       # endif
126       _GL_CXXALIASWARN (foo);
127       #elif defined GNULIB_POSIXCHECK
128       ...
129       #endif
130*/
131
132/* _GL_EXTERN_C declaration;
133   performs the declaration with C linkage.  */
134#if defined __cplusplus
135# define _GL_EXTERN_C extern "C"
136#else
137# define _GL_EXTERN_C extern
138#endif
139
140/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
141   declares a replacement function, named rpl_func, with the given prototype,
142   consisting of return type, parameters, and attributes.
143   Example:
144     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
145                                  _GL_ARG_NONNULL ((1)));
146 */
147#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
148  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
149#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
150  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
151
152/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
153   declares the system function, named func, with the given prototype,
154   consisting of return type, parameters, and attributes.
155   Example:
156     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
157                                  _GL_ARG_NONNULL ((1)));
158 */
159#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
160  _GL_EXTERN_C rettype func parameters_and_attributes
161
162/* _GL_CXXALIAS_RPL (func, rettype, parameters);
163   declares a C++ alias called GNULIB_NAMESPACE::func
164   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
165   Example:
166     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
167
168   Wrapping rpl_func in an object with an inline conversion operator
169   avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
170   actually used in the program.  */
171#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
172  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
173#if defined __cplusplus && defined GNULIB_NAMESPACE
174# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
175    namespace GNULIB_NAMESPACE                                \
176    {                                                         \
177      static const struct _gl_ ## func ## _wrapper            \
178      {                                                       \
179        typedef rettype (*type) parameters;                   \
180                                                              \
181        inline operator type () const                         \
182        {                                                     \
183          return ::rpl_func;                                  \
184        }                                                     \
185      } func = {};                                            \
186    }                                                         \
187    _GL_EXTERN_C int _gl_cxxalias_dummy
188#else
189# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
190    _GL_EXTERN_C int _gl_cxxalias_dummy
191#endif
192
193/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
194   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
195   except that the C function rpl_func may have a slightly different
196   declaration.  A cast is used to silence the "invalid conversion" error
197   that would otherwise occur.  */
198#if defined __cplusplus && defined GNULIB_NAMESPACE
199# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
200    namespace GNULIB_NAMESPACE                                     \
201    {                                                              \
202      static const struct _gl_ ## func ## _wrapper                 \
203      {                                                            \
204        typedef rettype (*type) parameters;                        \
205                                                                   \
206        inline operator type () const                              \
207        {                                                          \
208          return reinterpret_cast<type>(::rpl_func);               \
209        }                                                          \
210      } func = {};                                                 \
211    }                                                              \
212    _GL_EXTERN_C int _gl_cxxalias_dummy
213#else
214# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
215    _GL_EXTERN_C int _gl_cxxalias_dummy
216#endif
217
218/* _GL_CXXALIAS_SYS (func, rettype, parameters);
219   declares a C++ alias called GNULIB_NAMESPACE::func
220   that redirects to the system provided function func, if GNULIB_NAMESPACE
221   is defined.
222   Example:
223     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
224
225   Wrapping func in an object with an inline conversion operator
226   avoids a reference to func unless GNULIB_NAMESPACE::func is
227   actually used in the program.  */
228#if defined __cplusplus && defined GNULIB_NAMESPACE
229# define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
230    namespace GNULIB_NAMESPACE                                \
231    {                                                         \
232      static const struct _gl_ ## func ## _wrapper            \
233      {                                                       \
234        typedef rettype (*type) parameters;                   \
235                                                              \
236        inline operator type () const                         \
237        {                                                     \
238          return ::func;                                      \
239        }                                                     \
240      } func = {};                                            \
241    }                                                         \
242    _GL_EXTERN_C int _gl_cxxalias_dummy
243#else
244# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
245    _GL_EXTERN_C int _gl_cxxalias_dummy
246#endif
247
248/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
249   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
250   except that the C function func may have a slightly different declaration.
251   A cast is used to silence the "invalid conversion" error that would
252   otherwise occur.  */
253#if defined __cplusplus && defined GNULIB_NAMESPACE
254# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
255    namespace GNULIB_NAMESPACE                          \
256    {                                                   \
257      static const struct _gl_ ## func ## _wrapper      \
258      {                                                 \
259        typedef rettype (*type) parameters;             \
260                                                        \
261        inline operator type () const                   \
262        {                                               \
263          return reinterpret_cast<type>(::func);        \
264        }                                               \
265      } func = {};                                      \
266    }                                                   \
267    _GL_EXTERN_C int _gl_cxxalias_dummy
268#else
269# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
270    _GL_EXTERN_C int _gl_cxxalias_dummy
271#endif
272
273/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
274   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
275   except that the C function is picked among a set of overloaded functions,
276   namely the one with rettype2 and parameters2.  Two consecutive casts
277   are used to silence the "cannot find a match" and "invalid conversion"
278   errors that would otherwise occur.  */
279#if defined __cplusplus && defined GNULIB_NAMESPACE
280  /* The outer cast must be a reinterpret_cast.
281     The inner cast: When the function is defined as a set of overloaded
282     functions, it works as a static_cast<>, choosing the designated variant.
283     When the function is defined as a single variant, it works as a
284     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
285# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
286    namespace GNULIB_NAMESPACE                                                \
287    {                                                                         \
288      static const struct _gl_ ## func ## _wrapper                            \
289      {                                                                       \
290        typedef rettype (*type) parameters;                                   \
291                                                                              \
292        inline operator type () const                                         \
293        {                                                                     \
294          return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
295        }                                                                     \
296      } func = {};                                                            \
297    }                                                                         \
298    _GL_EXTERN_C int _gl_cxxalias_dummy
299#else
300# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
301    _GL_EXTERN_C int _gl_cxxalias_dummy
302#endif
303
304/* _GL_CXXALIASWARN (func);
305   causes a warning to be emitted when ::func is used but not when
306   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
307   variants.  */
308#if defined __cplusplus && defined GNULIB_NAMESPACE
309# define _GL_CXXALIASWARN(func) \
310   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
311# define _GL_CXXALIASWARN_1(func,namespace) \
312   _GL_CXXALIASWARN_2 (func, namespace)
313/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
314   we enable the warning only when not optimizing.  */
315# if !__OPTIMIZE__
316#  define _GL_CXXALIASWARN_2(func,namespace) \
317    _GL_WARN_ON_USE (func, \
318                     "The symbol ::" #func " refers to the system function. " \
319                     "Use " #namespace "::" #func " instead.")
320# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
321#  define _GL_CXXALIASWARN_2(func,namespace) \
322     extern __typeof__ (func) func
323# else
324#  define _GL_CXXALIASWARN_2(func,namespace) \
325     _GL_EXTERN_C int _gl_cxxalias_dummy
326# endif
327#else
328# define _GL_CXXALIASWARN(func) \
329    _GL_EXTERN_C int _gl_cxxalias_dummy
330#endif
331
332/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
333   causes a warning to be emitted when the given overloaded variant of ::func
334   is used but not when GNULIB_NAMESPACE::func is used.  */
335#if defined __cplusplus && defined GNULIB_NAMESPACE
336# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
337   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
338                        GNULIB_NAMESPACE)
339# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
340   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
341/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
342   we enable the warning only when not optimizing.  */
343# if !__OPTIMIZE__
344#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
345    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
346                         "The symbol ::" #func " refers to the system function. " \
347                         "Use " #namespace "::" #func " instead.")
348# else
349#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
350     _GL_EXTERN_C int _gl_cxxalias_dummy
351# endif
352#else
353# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
354    _GL_EXTERN_C int _gl_cxxalias_dummy
355#endif
356
357#endif /* _GL_CXXDEFS_H */
358
359/* The definition of _GL_WARN_ON_USE is copied here.  */
360/* A C macro for emitting warnings if a function is used.
361   Copyright (C) 2010-2020 Free Software Foundation, Inc.
362
363   This program is free software: you can redistribute it and/or modify it
364   under the terms of the GNU General Public License as published
365   by the Free Software Foundation; either version 3 of the License, or
366   (at your option) any later version.
367
368   This program is distributed in the hope that it will be useful,
369   but WITHOUT ANY WARRANTY; without even the implied warranty of
370   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
371   General Public License for more details.
372
373   You should have received a copy of the GNU General Public License
374   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
375
376/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
377   for FUNCTION which will then trigger a compiler warning containing
378   the text of "literal string" anywhere that function is called, if
379   supported by the compiler.  If the compiler does not support this
380   feature, the macro expands to an unused extern declaration.
381
382   _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
383   attribute used in _GL_WARN_ON_USE.  If the compiler does not support
384   this feature, it expands to empty.
385
386   These macros are useful for marking a function as a potential
387   portability trap, with the intent that "literal string" include
388   instructions on the replacement function that should be used
389   instead.
390   _GL_WARN_ON_USE is for functions with 'extern' linkage.
391   _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
392   linkage.
393
394   However, one of the reasons that a function is a portability trap is
395   if it has the wrong signature.  Declaring FUNCTION with a different
396   signature in C is a compilation error, so this macro must use the
397   same type as any existing declaration so that programs that avoid
398   the problematic FUNCTION do not fail to compile merely because they
399   included a header that poisoned the function.  But this implies that
400   _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
401   have a declaration.  Use of this macro implies that there must not
402   be any other macro hiding the declaration of FUNCTION; but
403   undefining FUNCTION first is part of the poisoning process anyway
404   (although for symbols that are provided only via a macro, the result
405   is a compilation error rather than a warning containing
406   "literal string").  Also note that in C++, it is only safe to use if
407   FUNCTION has no overloads.
408
409   For an example, it is possible to poison 'getline' by:
410   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
411     [getline]) in configure.ac, which potentially defines
412     HAVE_RAW_DECL_GETLINE
413   - adding this code to a header that wraps the system <stdio.h>:
414     #undef getline
415     #if HAVE_RAW_DECL_GETLINE
416     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
417       "not universally present; use the gnulib module getline");
418     #endif
419
420   It is not possible to directly poison global variables.  But it is
421   possible to write a wrapper accessor function, and poison that
422   (less common usage, like &environ, will cause a compilation error
423   rather than issue the nice warning, but the end result of informing
424   the developer about their portability problem is still achieved):
425     #if HAVE_RAW_DECL_ENVIRON
426     static char ***
427     rpl_environ (void) { return &environ; }
428     _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
429     # undef environ
430     # define environ (*rpl_environ ())
431     #endif
432   or better (avoiding contradictory use of 'static' and 'extern'):
433     #if HAVE_RAW_DECL_ENVIRON
434     static char ***
435     _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
436     rpl_environ (void) { return &environ; }
437     # undef environ
438     # define environ (*rpl_environ ())
439     #endif
440   */
441#ifndef _GL_WARN_ON_USE
442
443# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
444/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
445#  define _GL_WARN_ON_USE(function, message) \
446extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
447#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
448  __attribute__ ((__warning__ (message)))
449# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
450/* Verify the existence of the function.  */
451#  define _GL_WARN_ON_USE(function, message) \
452extern __typeof__ (function) function
453#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
454# else /* Unsupported.  */
455#  define _GL_WARN_ON_USE(function, message) \
456_GL_WARN_EXTERN_C int _gl_warn_on_use
457#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
458# endif
459#endif
460
461/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
462   is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the
463   function is declared with the given prototype, consisting of return type,
464   parameters, and attributes.
465   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
466   not work in this case.  */
467#ifndef _GL_WARN_ON_USE_CXX
468# if !defined __cplusplus
469#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
470     _GL_WARN_ON_USE (function, msg)
471# else
472#  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
473#   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
474extern rettype function parameters_and_attributes \
475     __attribute__ ((__warning__ (msg)))
476#  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
477/* Verify the existence of the function.  */
478#   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
479extern rettype function parameters_and_attributes
480#  else /* Unsupported.  */
481#   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
482_GL_WARN_EXTERN_C int _gl_warn_on_use
483#  endif
484# endif
485#endif
486
487/* _GL_WARN_EXTERN_C declaration;
488   performs the declaration with C linkage.  */
489#ifndef _GL_WARN_EXTERN_C
490# if defined __cplusplus
491#  define _GL_WARN_EXTERN_C extern "C"
492# else
493#  define _GL_WARN_EXTERN_C extern
494# endif
495#endif
496
497/* Return non-zero if c is a blank, i.e. a space or tab character.  */
498#if 1
499# if !1
500_GL_EXTERN_C int isblank (int c);
501# endif
502#elif defined GNULIB_POSIXCHECK
503# undef isblank
504# if HAVE_RAW_DECL_ISBLANK
505_GL_WARN_ON_USE (isblank, "isblank is unportable - "
506                 "use gnulib module isblank for portability");
507# endif
508#endif
509
510#endif /* _GL_CTYPE_H */
511#endif /* _GL_CTYPE_H */
512