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 substitute for ISO C99 <wctype.h>, for platforms that lack it.
7
8   Copyright (C) 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/* Written by Bruno Haible and Paul Eggert.  */
24
25/*
26 * ISO C 99 <wctype.h> for platforms that lack it.
27 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html>
28 *
29 * iswctype, towctrans, towlower, towupper, wctrans, wctype,
30 * wctrans_t, and wctype_t are not yet implemented.
31 */
32
33#if __GNUC__ >= 3
34#pragma GCC system_header
35#endif
36
37
38#if (defined __MINGW32__ && defined __CTYPE_H_SOURCED__)
39
40/* Special invocation convention:
41   - With MinGW 3.22, when <ctype.h> includes <wctype.h>, only some part of
42     <wctype.h> is being processed, which doesn't include the idempotency
43     guard.   */
44
45#include_next <wctype.h>
46
47#else
48/* Normal invocation convention.  */
49
50#ifndef _GL_WCTYPE_H
51
52#if 1
53/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */
54# include <wchar.h>
55#endif
56
57/* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and
58   isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>.  Include
59   <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the
60   declarations.  */
61#if defined _WIN32 && ! defined __CYGWIN__
62# include <ctype.h>
63# include <wchar.h>
64#endif
65
66/* Include the original <wctype.h> if it exists.
67   BeOS 5 has the functions but no <wctype.h>.  */
68/* The include_next requires a split double-inclusion guard.  */
69#if 1
70# include_next <wctype.h>
71#endif
72
73#ifndef _GL_WCTYPE_H
74#define _GL_WCTYPE_H
75
76#ifndef _GL_INLINE_HEADER_BEGIN
77 #error "Please include config.h first."
78#endif
79_GL_INLINE_HEADER_BEGIN
80#ifndef _GL_WCTYPE_INLINE
81# define _GL_WCTYPE_INLINE _GL_INLINE
82#endif
83
84/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
85/* C++ compatible function declaration macros.
86   Copyright (C) 2010-2022 Free Software Foundation, Inc.
87
88   This program is free software: you can redistribute it and/or modify it
89   under the terms of the GNU Lesser General Public License as published
90   by the Free Software Foundation; either version 2 of the License, or
91   (at your option) any later version.
92
93   This program is distributed in the hope that it will be useful,
94   but WITHOUT ANY WARRANTY; without even the implied warranty of
95   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
96   Lesser General Public License for more details.
97
98   You should have received a copy of the GNU Lesser General Public License
99   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
100
101#ifndef _GL_CXXDEFS_H
102#define _GL_CXXDEFS_H
103
104/* Begin/end the GNULIB_NAMESPACE namespace.  */
105#if defined __cplusplus && defined GNULIB_NAMESPACE
106# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
107# define _GL_END_NAMESPACE }
108#else
109# define _GL_BEGIN_NAMESPACE
110# define _GL_END_NAMESPACE
111#endif
112
113/* The three most frequent use cases of these macros are:
114
115   * For providing a substitute for a function that is missing on some
116     platforms, but is declared and works fine on the platforms on which
117     it exists:
118
119       #if @GNULIB_FOO@
120       # if !@HAVE_FOO@
121       _GL_FUNCDECL_SYS (foo, ...);
122       # endif
123       _GL_CXXALIAS_SYS (foo, ...);
124       _GL_CXXALIASWARN (foo);
125       #elif defined GNULIB_POSIXCHECK
126       ...
127       #endif
128
129   * For providing a replacement for a function that exists on all platforms,
130     but is broken/insufficient and needs to be replaced on some platforms:
131
132       #if @GNULIB_FOO@
133       # if @REPLACE_FOO@
134       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
135       #   undef foo
136       #   define foo rpl_foo
137       #  endif
138       _GL_FUNCDECL_RPL (foo, ...);
139       _GL_CXXALIAS_RPL (foo, ...);
140       # else
141       _GL_CXXALIAS_SYS (foo, ...);
142       # endif
143       _GL_CXXALIASWARN (foo);
144       #elif defined GNULIB_POSIXCHECK
145       ...
146       #endif
147
148   * For providing a replacement for a function that exists on some platforms
149     but is broken/insufficient and needs to be replaced on some of them and
150     is additionally either missing or undeclared on some other platforms:
151
152       #if @GNULIB_FOO@
153       # if @REPLACE_FOO@
154       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
155       #   undef foo
156       #   define foo rpl_foo
157       #  endif
158       _GL_FUNCDECL_RPL (foo, ...);
159       _GL_CXXALIAS_RPL (foo, ...);
160       # else
161       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
162       _GL_FUNCDECL_SYS (foo, ...);
163       #  endif
164       _GL_CXXALIAS_SYS (foo, ...);
165       # endif
166       _GL_CXXALIASWARN (foo);
167       #elif defined GNULIB_POSIXCHECK
168       ...
169       #endif
170*/
171
172/* _GL_EXTERN_C declaration;
173   performs the declaration with C linkage.  */
174#if defined __cplusplus
175# define _GL_EXTERN_C extern "C"
176#else
177# define _GL_EXTERN_C extern
178#endif
179
180/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
181   declares a replacement function, named rpl_func, with the given prototype,
182   consisting of return type, parameters, and attributes.
183   Example:
184     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
185                                  _GL_ARG_NONNULL ((1)));
186 */
187#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
188  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
189#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
190  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
191
192/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
193   declares the system function, named func, with the given prototype,
194   consisting of return type, parameters, and attributes.
195   Example:
196     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
197                                  _GL_ARG_NONNULL ((1)));
198 */
199#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
200  _GL_EXTERN_C rettype func parameters_and_attributes
201
202/* _GL_CXXALIAS_RPL (func, rettype, parameters);
203   declares a C++ alias called GNULIB_NAMESPACE::func
204   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
205   Example:
206     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
207
208   Wrapping rpl_func in an object with an inline conversion operator
209   avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
210   actually used in the program.  */
211#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
212  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
213#if defined __cplusplus && defined GNULIB_NAMESPACE
214# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
215    namespace GNULIB_NAMESPACE                                \
216    {                                                         \
217      static const struct _gl_ ## func ## _wrapper            \
218      {                                                       \
219        typedef rettype (*type) parameters;                   \
220                                                              \
221        inline operator type () const                         \
222        {                                                     \
223          return ::rpl_func;                                  \
224        }                                                     \
225      } func = {};                                            \
226    }                                                         \
227    _GL_EXTERN_C int _gl_cxxalias_dummy
228#else
229# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
230    _GL_EXTERN_C int _gl_cxxalias_dummy
231#endif
232
233/* _GL_CXXALIAS_MDA (func, rettype, parameters);
234   is to be used when func is a Microsoft deprecated alias, on native Windows.
235   It declares a C++ alias called GNULIB_NAMESPACE::func
236   that redirects to _func, if GNULIB_NAMESPACE is defined.
237   Example:
238     _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
239 */
240#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
241  _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
242
243/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
244   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
245   except that the C function rpl_func may have a slightly different
246   declaration.  A cast is used to silence the "invalid conversion" error
247   that would otherwise occur.  */
248#if defined __cplusplus && defined GNULIB_NAMESPACE
249# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
250    namespace GNULIB_NAMESPACE                                     \
251    {                                                              \
252      static const struct _gl_ ## func ## _wrapper                 \
253      {                                                            \
254        typedef rettype (*type) parameters;                        \
255                                                                   \
256        inline operator type () const                              \
257        {                                                          \
258          return reinterpret_cast<type>(::rpl_func);               \
259        }                                                          \
260      } func = {};                                                 \
261    }                                                              \
262    _GL_EXTERN_C int _gl_cxxalias_dummy
263#else
264# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
265    _GL_EXTERN_C int _gl_cxxalias_dummy
266#endif
267
268/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
269   is like  _GL_CXXALIAS_MDA (func, rettype, parameters);
270   except that the C function func may have a slightly different declaration.
271   A cast is used to silence the "invalid conversion" error that would
272   otherwise occur.  */
273#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
274  _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
275
276/* _GL_CXXALIAS_SYS (func, rettype, parameters);
277   declares a C++ alias called GNULIB_NAMESPACE::func
278   that redirects to the system provided function func, if GNULIB_NAMESPACE
279   is defined.
280   Example:
281     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
282
283   Wrapping func in an object with an inline conversion operator
284   avoids a reference to func unless GNULIB_NAMESPACE::func is
285   actually used in the program.  */
286#if defined __cplusplus && defined GNULIB_NAMESPACE
287# define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
288    namespace GNULIB_NAMESPACE                                \
289    {                                                         \
290      static const struct _gl_ ## func ## _wrapper            \
291      {                                                       \
292        typedef rettype (*type) parameters;                   \
293                                                              \
294        inline operator type () const                         \
295        {                                                     \
296          return ::func;                                      \
297        }                                                     \
298      } func = {};                                            \
299    }                                                         \
300    _GL_EXTERN_C int _gl_cxxalias_dummy
301#else
302# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
303    _GL_EXTERN_C int _gl_cxxalias_dummy
304#endif
305
306/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
307   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
308   except that the C function func may have a slightly different declaration.
309   A cast is used to silence the "invalid conversion" error that would
310   otherwise occur.  */
311#if defined __cplusplus && defined GNULIB_NAMESPACE
312# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
313    namespace GNULIB_NAMESPACE                          \
314    {                                                   \
315      static const struct _gl_ ## func ## _wrapper      \
316      {                                                 \
317        typedef rettype (*type) parameters;             \
318                                                        \
319        inline operator type () const                   \
320        {                                               \
321          return reinterpret_cast<type>(::func);        \
322        }                                               \
323      } func = {};                                      \
324    }                                                   \
325    _GL_EXTERN_C int _gl_cxxalias_dummy
326#else
327# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
328    _GL_EXTERN_C int _gl_cxxalias_dummy
329#endif
330
331/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
332   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
333   except that the C function is picked among a set of overloaded functions,
334   namely the one with rettype2 and parameters2.  Two consecutive casts
335   are used to silence the "cannot find a match" and "invalid conversion"
336   errors that would otherwise occur.  */
337#if defined __cplusplus && defined GNULIB_NAMESPACE
338  /* The outer cast must be a reinterpret_cast.
339     The inner cast: When the function is defined as a set of overloaded
340     functions, it works as a static_cast<>, choosing the designated variant.
341     When the function is defined as a single variant, it works as a
342     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
343# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
344    namespace GNULIB_NAMESPACE                                                \
345    {                                                                         \
346      static const struct _gl_ ## func ## _wrapper                            \
347      {                                                                       \
348        typedef rettype (*type) parameters;                                   \
349                                                                              \
350        inline operator type () const                                         \
351        {                                                                     \
352          return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
353        }                                                                     \
354      } func = {};                                                            \
355    }                                                                         \
356    _GL_EXTERN_C int _gl_cxxalias_dummy
357#else
358# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
359    _GL_EXTERN_C int _gl_cxxalias_dummy
360#endif
361
362/* _GL_CXXALIASWARN (func);
363   causes a warning to be emitted when ::func is used but not when
364   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
365   variants.  */
366#if defined __cplusplus && defined GNULIB_NAMESPACE
367# define _GL_CXXALIASWARN(func) \
368   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
369# define _GL_CXXALIASWARN_1(func,namespace) \
370   _GL_CXXALIASWARN_2 (func, namespace)
371/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
372   we enable the warning only when not optimizing.  */
373# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
374#  define _GL_CXXALIASWARN_2(func,namespace) \
375    _GL_WARN_ON_USE (func, \
376                     "The symbol ::" #func " refers to the system function. " \
377                     "Use " #namespace "::" #func " instead.")
378# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
379#  define _GL_CXXALIASWARN_2(func,namespace) \
380     extern __typeof__ (func) func
381# else
382#  define _GL_CXXALIASWARN_2(func,namespace) \
383     _GL_EXTERN_C int _gl_cxxalias_dummy
384# endif
385#else
386# define _GL_CXXALIASWARN(func) \
387    _GL_EXTERN_C int _gl_cxxalias_dummy
388#endif
389
390/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
391   causes a warning to be emitted when the given overloaded variant of ::func
392   is used but not when GNULIB_NAMESPACE::func is used.  */
393#if defined __cplusplus && defined GNULIB_NAMESPACE
394# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
395   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
396                        GNULIB_NAMESPACE)
397# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
398   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
399/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
400   we enable the warning only when not optimizing.  */
401# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
402#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
403    _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
404                         "The symbol ::" #func " refers to the system function. " \
405                         "Use " #namespace "::" #func " instead.")
406# else
407#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
408     _GL_EXTERN_C int _gl_cxxalias_dummy
409# endif
410#else
411# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
412    _GL_EXTERN_C int _gl_cxxalias_dummy
413#endif
414
415#endif /* _GL_CXXDEFS_H */
416
417/* The definition of _GL_WARN_ON_USE is copied here.  */
418/* A C macro for emitting warnings if a function is used.
419   Copyright (C) 2010-2022 Free Software Foundation, Inc.
420
421   This program is free software: you can redistribute it and/or modify it
422   under the terms of the GNU Lesser General Public License as published
423   by the Free Software Foundation; either version 2 of the License, or
424   (at your option) any later version.
425
426   This program is distributed in the hope that it will be useful,
427   but WITHOUT ANY WARRANTY; without even the implied warranty of
428   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
429   Lesser General Public License for more details.
430
431   You should have received a copy of the GNU Lesser General Public License
432   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
433
434/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
435   for FUNCTION which will then trigger a compiler warning containing
436   the text of "literal string" anywhere that function is called, if
437   supported by the compiler.  If the compiler does not support this
438   feature, the macro expands to an unused extern declaration.
439
440   _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
441   attribute used in _GL_WARN_ON_USE.  If the compiler does not support
442   this feature, it expands to empty.
443
444   These macros are useful for marking a function as a potential
445   portability trap, with the intent that "literal string" include
446   instructions on the replacement function that should be used
447   instead.
448   _GL_WARN_ON_USE is for functions with 'extern' linkage.
449   _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
450   linkage.
451
452   However, one of the reasons that a function is a portability trap is
453   if it has the wrong signature.  Declaring FUNCTION with a different
454   signature in C is a compilation error, so this macro must use the
455   same type as any existing declaration so that programs that avoid
456   the problematic FUNCTION do not fail to compile merely because they
457   included a header that poisoned the function.  But this implies that
458   _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
459   have a declaration.  Use of this macro implies that there must not
460   be any other macro hiding the declaration of FUNCTION; but
461   undefining FUNCTION first is part of the poisoning process anyway
462   (although for symbols that are provided only via a macro, the result
463   is a compilation error rather than a warning containing
464   "literal string").  Also note that in C++, it is only safe to use if
465   FUNCTION has no overloads.
466
467   For an example, it is possible to poison 'getline' by:
468   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
469     [getline]) in configure.ac, which potentially defines
470     HAVE_RAW_DECL_GETLINE
471   - adding this code to a header that wraps the system <stdio.h>:
472     #undef getline
473     #if HAVE_RAW_DECL_GETLINE
474     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
475       "not universally present; use the gnulib module getline");
476     #endif
477
478   It is not possible to directly poison global variables.  But it is
479   possible to write a wrapper accessor function, and poison that
480   (less common usage, like &environ, will cause a compilation error
481   rather than issue the nice warning, but the end result of informing
482   the developer about their portability problem is still achieved):
483     #if HAVE_RAW_DECL_ENVIRON
484     static char ***
485     rpl_environ (void) { return &environ; }
486     _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
487     # undef environ
488     # define environ (*rpl_environ ())
489     #endif
490   or better (avoiding contradictory use of 'static' and 'extern'):
491     #if HAVE_RAW_DECL_ENVIRON
492     static char ***
493     _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
494     rpl_environ (void) { return &environ; }
495     # undef environ
496     # define environ (*rpl_environ ())
497     #endif
498   */
499#ifndef _GL_WARN_ON_USE
500
501# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
502/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
503#  define _GL_WARN_ON_USE(function, message) \
504_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
505#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
506  __attribute__ ((__warning__ (message)))
507# elif __clang_major__ >= 4
508/* Another compiler attribute is available in clang.  */
509#  define _GL_WARN_ON_USE(function, message) \
510_GL_WARN_EXTERN_C __typeof__ (function) function \
511  __attribute__ ((__diagnose_if__ (1, message, "warning")))
512#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
513  __attribute__ ((__diagnose_if__ (1, message, "warning")))
514# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
515/* Verify the existence of the function.  */
516#  define _GL_WARN_ON_USE(function, message) \
517_GL_WARN_EXTERN_C __typeof__ (function) function
518#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
519# else /* Unsupported.  */
520#  define _GL_WARN_ON_USE(function, message) \
521_GL_WARN_EXTERN_C int _gl_warn_on_use
522#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
523# endif
524#endif
525
526/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
527   is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
528   function is declared with the given prototype, consisting of return type,
529   parameters, and attributes.
530   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
531   not work in this case.  */
532#ifndef _GL_WARN_ON_USE_CXX
533# if !defined __cplusplus
534#  define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
535     _GL_WARN_ON_USE (function, msg)
536# else
537#  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
538/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
539#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
540extern rettype_gcc function parameters_and_attributes \
541  __attribute__ ((__warning__ (msg)))
542#  elif __clang_major__ >= 4
543/* Another compiler attribute is available in clang.  */
544#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
545extern rettype_clang function parameters_and_attributes \
546  __attribute__ ((__diagnose_if__ (1, msg, "warning")))
547#  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
548/* Verify the existence of the function.  */
549#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
550extern rettype_gcc function parameters_and_attributes
551#  else /* Unsupported.  */
552#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
553_GL_WARN_EXTERN_C int _gl_warn_on_use
554#  endif
555# endif
556#endif
557
558/* _GL_WARN_EXTERN_C declaration;
559   performs the declaration with C linkage.  */
560#ifndef _GL_WARN_EXTERN_C
561# if defined __cplusplus
562#  define _GL_WARN_EXTERN_C extern "C"
563# else
564#  define _GL_WARN_EXTERN_C extern
565# endif
566#endif
567
568/* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
569   #defines a number of identifiers in the application namespace.  Revert
570   these #defines.  */
571#ifdef __sun
572# undef multibyte
573# undef eucw1
574# undef eucw2
575# undef eucw3
576# undef scrw1
577# undef scrw2
578# undef scrw3
579#endif
580
581/* Define wint_t and WEOF.  (Also done in wchar.in.h.)  */
582#if !1 && !defined wint_t
583# define wint_t int
584# ifndef WEOF
585#  define WEOF -1
586# endif
587#else
588/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
589   <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
590   wint_t must be "unchanged by default argument promotions".  Override it.  */
591# if 0
592#  if !GNULIB_defined_wint_t
593#   if 0
594#    include <crtdefs.h>
595#   else
596#    include <stddef.h>
597#   endif
598typedef unsigned int rpl_wint_t;
599#   undef wint_t
600#   define wint_t rpl_wint_t
601#   define GNULIB_defined_wint_t 1
602#  endif
603# endif
604# ifndef WEOF
605#  define WEOF ((wint_t) -1)
606# endif
607#endif
608
609
610#if !GNULIB_defined_wctype_functions
611
612/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
613   Linux libc5 has <wctype.h> and the functions but they are broken.
614   mingw and MSVC have <wctype.h> and the functions but they take a wchar_t
615   as argument, not an rpl_wint_t.
616   Assume all 11 functions (all isw* except iswblank) are implemented the
617   same way, or not at all.  */
618# if ! 1 || 0
619
620#  if 0 /* implies 0 */
621
622_GL_WCTYPE_INLINE int
623rpl_iswalnum (wint_t wc)
624{
625  return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0);
626}
627
628_GL_WCTYPE_INLINE int
629rpl_iswalpha (wint_t wc)
630{
631  return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0);
632}
633
634_GL_WCTYPE_INLINE int
635rpl_iswblank (wint_t wc)
636{
637  return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0);
638}
639
640_GL_WCTYPE_INLINE int
641rpl_iswcntrl (wint_t wc)
642{
643  return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0);
644}
645
646_GL_WCTYPE_INLINE int
647rpl_iswdigit (wint_t wc)
648{
649  return ((wchar_t) wc == wc ? wc >= '0' && wc <= '9' : 0);
650}
651
652_GL_WCTYPE_INLINE int
653rpl_iswgraph (wint_t wc)
654{
655  return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0);
656}
657
658_GL_WCTYPE_INLINE int
659rpl_iswlower (wint_t wc)
660{
661  return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0);
662}
663
664_GL_WCTYPE_INLINE int
665rpl_iswprint (wint_t wc)
666{
667  return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0);
668}
669
670_GL_WCTYPE_INLINE int
671rpl_iswpunct (wint_t wc)
672{
673  return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0);
674}
675
676_GL_WCTYPE_INLINE int
677rpl_iswspace (wint_t wc)
678{
679  return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0);
680}
681
682_GL_WCTYPE_INLINE int
683rpl_iswupper (wint_t wc)
684{
685  return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0);
686}
687
688_GL_WCTYPE_INLINE int
689rpl_iswxdigit (wint_t wc)
690{
691  return ((wchar_t) wc == wc
692          ? (wc >= '0' && wc <= '9')
693            || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')
694          : 0);
695}
696
697_GL_WCTYPE_INLINE wint_t
698rpl_towlower (wint_t wc)
699{
700  return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc);
701}
702
703_GL_WCTYPE_INLINE wint_t
704rpl_towupper (wint_t wc)
705{
706  return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc);
707}
708
709#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
710#    undef iswalnum
711#    undef iswalpha
712#    undef iswblank
713#    undef iswcntrl
714#    undef iswdigit
715#    undef iswgraph
716#    undef iswlower
717#    undef iswprint
718#    undef iswpunct
719#    undef iswspace
720#    undef iswupper
721#    undef iswxdigit
722#    undef towlower
723#    undef towupper
724#    define iswalnum rpl_iswalnum
725#    define iswalpha rpl_iswalpha
726#    define iswblank rpl_iswblank
727#    define iswcntrl rpl_iswcntrl
728#    define iswdigit rpl_iswdigit
729#    define iswgraph rpl_iswgraph
730#    define iswlower rpl_iswlower
731#    define iswprint rpl_iswprint
732#    define iswpunct rpl_iswpunct
733#    define iswspace rpl_iswspace
734#    define iswupper rpl_iswupper
735#    define iswxdigit rpl_iswxdigit
736#    define towlower rpl_towlower
737#    define towupper rpl_towupper
738#   endif
739
740#  else
741
742/* IRIX 5.3 has macros but no functions, its isw* macros refer to an
743   undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
744   refer to system functions like _iswctype that are not in the
745   standard C library.  Rather than try to get ancient buggy
746   implementations like this to work, just disable them.  */
747#   undef iswalnum
748#   undef iswalpha
749#   undef iswblank
750#   undef iswcntrl
751#   undef iswdigit
752#   undef iswgraph
753#   undef iswlower
754#   undef iswprint
755#   undef iswpunct
756#   undef iswspace
757#   undef iswupper
758#   undef iswxdigit
759#   undef towlower
760#   undef towupper
761
762/* Linux libc5 has <wctype.h> and the functions but they are broken.  */
763#   if 0
764#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
765#     define iswalnum rpl_iswalnum
766#     define iswalpha rpl_iswalpha
767#     define iswblank rpl_iswblank
768#     define iswcntrl rpl_iswcntrl
769#     define iswdigit rpl_iswdigit
770#     define iswgraph rpl_iswgraph
771#     define iswlower rpl_iswlower
772#     define iswprint rpl_iswprint
773#     define iswpunct rpl_iswpunct
774#     define iswspace rpl_iswspace
775#     define iswupper rpl_iswupper
776#     define iswxdigit rpl_iswxdigit
777#    endif
778#   endif
779#   if 0
780#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
781#     define towlower rpl_towlower
782#     define towupper rpl_towupper
783#    endif
784#   endif
785
786_GL_WCTYPE_INLINE int
787#   if 0
788rpl_iswalnum
789#   else
790iswalnum
791#   endif
792         (wint_t wc)
793{
794  return ((wc >= '0' && wc <= '9')
795          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
796}
797
798_GL_WCTYPE_INLINE int
799#   if 0
800rpl_iswalpha
801#   else
802iswalpha
803#   endif
804         (wint_t wc)
805{
806  return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
807}
808
809_GL_WCTYPE_INLINE int
810#   if 0
811rpl_iswblank
812#   else
813iswblank
814#   endif
815         (wint_t wc)
816{
817  return wc == ' ' || wc == '\t';
818}
819
820_GL_WCTYPE_INLINE int
821#   if 0
822rpl_iswcntrl
823#   else
824iswcntrl
825#   endif
826        (wint_t wc)
827{
828  return (wc & ~0x1f) == 0 || wc == 0x7f;
829}
830
831_GL_WCTYPE_INLINE int
832#   if 0
833rpl_iswdigit
834#   else
835iswdigit
836#   endif
837         (wint_t wc)
838{
839  return wc >= '0' && wc <= '9';
840}
841
842_GL_WCTYPE_INLINE int
843#   if 0
844rpl_iswgraph
845#   else
846iswgraph
847#   endif
848         (wint_t wc)
849{
850  return wc >= '!' && wc <= '~';
851}
852
853_GL_WCTYPE_INLINE int
854#   if 0
855rpl_iswlower
856#   else
857iswlower
858#   endif
859         (wint_t wc)
860{
861  return wc >= 'a' && wc <= 'z';
862}
863
864_GL_WCTYPE_INLINE int
865#   if 0
866rpl_iswprint
867#   else
868iswprint
869#   endif
870         (wint_t wc)
871{
872  return wc >= ' ' && wc <= '~';
873}
874
875_GL_WCTYPE_INLINE int
876#   if 0
877rpl_iswpunct
878#   else
879iswpunct
880#   endif
881         (wint_t wc)
882{
883  return (wc >= '!' && wc <= '~'
884          && !((wc >= '0' && wc <= '9')
885               || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
886}
887
888_GL_WCTYPE_INLINE int
889#   if 0
890rpl_iswspace
891#   else
892iswspace
893#   endif
894         (wint_t wc)
895{
896  return (wc == ' ' || wc == '\t'
897          || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
898}
899
900_GL_WCTYPE_INLINE int
901#   if 0
902rpl_iswupper
903#   else
904iswupper
905#   endif
906         (wint_t wc)
907{
908  return wc >= 'A' && wc <= 'Z';
909}
910
911_GL_WCTYPE_INLINE int
912#   if 0
913rpl_iswxdigit
914#   else
915iswxdigit
916#   endif
917          (wint_t wc)
918{
919  return ((wc >= '0' && wc <= '9')
920          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
921}
922
923_GL_WCTYPE_INLINE wint_t
924#   if 0
925rpl_towlower
926#   else
927towlower
928#   endif
929         (wint_t wc)
930{
931  return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
932}
933
934_GL_WCTYPE_INLINE wint_t
935#   if 0
936rpl_towupper
937#   else
938towupper
939#   endif
940         (wint_t wc)
941{
942  return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
943}
944
945#  endif
946
947# else
948/* Only some of the functions are missing or broken.  */
949
950#  if 0 && (! 1 || 0)
951/* Only the iswblank function is missing.  */
952#   if 0
953#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
954#     define iswblank rpl_iswblank
955#    endif
956_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
957#   else
958_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
959#   endif
960#  endif
961
962#  if 0
963#   if 0
964#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
965#     undef iswdigit
966#     define iswdigit rpl_iswdigit
967#    endif
968_GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc));
969#   endif
970#  endif
971
972#  if 0
973#   if 0
974#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
975#     undef iswxdigit
976#     define iswxdigit rpl_iswxdigit
977#    endif
978_GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc));
979#   endif
980#  endif
981
982# endif
983
984# if defined __MINGW32__ && !0
985
986/* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
987   The functions towlower and towupper are implemented in the MSVCRT library
988   to take a wchar_t argument and return a wchar_t result.  mingw declares
989   these functions to take a wint_t argument and return a wint_t result.
990   This means that:
991   1. When the user passes an argument outside the range 0x0000..0xFFFF, the
992      function will look only at the lower 16 bits.  This is allowed according
993      to POSIX.
994   2. The return value is returned in the lower 16 bits of the result register.
995      The upper 16 bits are random: whatever happened to be in that part of the
996      result register.  We need to fix this by adding a zero-extend from
997      wchar_t to wint_t after the call.  */
998
999_GL_WCTYPE_INLINE wint_t
1000rpl_towlower (wint_t wc)
1001{
1002  return (wint_t) (wchar_t) towlower (wc);
1003}
1004#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1005#   define towlower rpl_towlower
1006#  endif
1007
1008_GL_WCTYPE_INLINE wint_t
1009rpl_towupper (wint_t wc)
1010{
1011  return (wint_t) (wchar_t) towupper (wc);
1012}
1013#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1014#   define towupper rpl_towupper
1015#  endif
1016
1017# endif /* __MINGW32__ && !0 */
1018
1019# define GNULIB_defined_wctype_functions 1
1020#endif
1021
1022#if 0
1023_GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
1024#else
1025_GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
1026#endif
1027#if 0
1028_GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
1029#else
1030_GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
1031#endif
1032#if 0
1033_GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
1034#else
1035_GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
1036#endif
1037#if 0
1038# if 0
1039_GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
1040# else
1041_GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
1042# endif
1043#endif
1044#if 0
1045_GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
1046#else
1047_GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
1048#endif
1049#if 0
1050_GL_CXXALIAS_RPL (iswlower, int, (wint_t wc));
1051#else
1052_GL_CXXALIAS_SYS (iswlower, int, (wint_t wc));
1053#endif
1054#if 0
1055_GL_CXXALIAS_RPL (iswprint, int, (wint_t wc));
1056#else
1057_GL_CXXALIAS_SYS (iswprint, int, (wint_t wc));
1058#endif
1059#if 0
1060_GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc));
1061#else
1062_GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc));
1063#endif
1064#if 0
1065_GL_CXXALIAS_RPL (iswspace, int, (wint_t wc));
1066#else
1067_GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
1068#endif
1069#if 0
1070_GL_CXXALIAS_RPL (iswupper, int, (wint_t wc));
1071#else
1072_GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
1073#endif
1074#if 0
1075# if 0
1076_GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
1077# else
1078_GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
1079# endif
1080#endif
1081#if __GLIBC__ >= 2
1082_GL_CXXALIASWARN (iswalnum);
1083_GL_CXXALIASWARN (iswalpha);
1084_GL_CXXALIASWARN (iswcntrl);
1085_GL_CXXALIASWARN (iswdigit);
1086_GL_CXXALIASWARN (iswgraph);
1087_GL_CXXALIASWARN (iswlower);
1088_GL_CXXALIASWARN (iswprint);
1089_GL_CXXALIASWARN (iswpunct);
1090_GL_CXXALIASWARN (iswspace);
1091_GL_CXXALIASWARN (iswupper);
1092_GL_CXXALIASWARN (iswxdigit);
1093#endif
1094
1095#if 0
1096# if 0 || 0
1097_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
1098# else
1099_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
1100# endif
1101# if __GLIBC__ >= 2
1102_GL_CXXALIASWARN (iswblank);
1103# endif
1104#endif
1105
1106#if !1
1107# if !GNULIB_defined_wctype_t
1108typedef void * wctype_t;
1109#  define GNULIB_defined_wctype_t 1
1110# endif
1111#endif
1112
1113/* Get a descriptor for a wide character property.  */
1114#if 0
1115# if !1
1116_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name));
1117# endif
1118_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
1119# if __GLIBC__ >= 2
1120_GL_CXXALIASWARN (wctype);
1121# endif
1122#elif defined GNULIB_POSIXCHECK
1123# undef wctype
1124# if HAVE_RAW_DECL_WCTYPE
1125_GL_WARN_ON_USE (wctype, "wctype is unportable - "
1126                 "use gnulib module wctype for portability");
1127# endif
1128#endif
1129
1130/* Test whether a wide character has a given property.
1131   The argument WC must be either a wchar_t value or WEOF.
1132   The argument DESC must have been returned by the wctype() function.  */
1133#if 0
1134# if 0
1135#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1136#   undef iswctype
1137#   define iswctype rpl_iswctype
1138#  endif
1139_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc));
1140_GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc));
1141# else
1142#  if !1
1143_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
1144#  endif
1145_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
1146# endif
1147# if __GLIBC__ >= 2
1148_GL_CXXALIASWARN (iswctype);
1149# endif
1150#elif defined GNULIB_POSIXCHECK
1151# undef iswctype
1152# if HAVE_RAW_DECL_ISWCTYPE
1153_GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
1154                 "use gnulib module iswctype for portability");
1155# endif
1156#endif
1157
1158#if 0 || defined __MINGW32__
1159_GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
1160_GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
1161#else
1162_GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
1163_GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
1164#endif
1165#if __GLIBC__ >= 2
1166_GL_CXXALIASWARN (towlower);
1167_GL_CXXALIASWARN (towupper);
1168#endif
1169
1170#if !1
1171# if !GNULIB_defined_wctrans_t
1172typedef void * wctrans_t;
1173#  define GNULIB_defined_wctrans_t 1
1174# endif
1175#endif
1176
1177/* Get a descriptor for a wide character case conversion.  */
1178#if 0
1179# if !1
1180_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name));
1181# endif
1182_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
1183# if __GLIBC__ >= 2
1184_GL_CXXALIASWARN (wctrans);
1185# endif
1186#elif defined GNULIB_POSIXCHECK
1187# undef wctrans
1188# if HAVE_RAW_DECL_WCTRANS
1189_GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
1190                 "use gnulib module wctrans for portability");
1191# endif
1192#endif
1193
1194/* Perform a given case conversion on a wide character.
1195   The argument WC must be either a wchar_t value or WEOF.
1196   The argument DESC must have been returned by the wctrans() function.  */
1197#if 0
1198# if !1
1199_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
1200# endif
1201_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
1202# if __GLIBC__ >= 2
1203_GL_CXXALIASWARN (towctrans);
1204# endif
1205#elif defined GNULIB_POSIXCHECK
1206# undef towctrans
1207# if HAVE_RAW_DECL_TOWCTRANS
1208_GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
1209                 "use gnulib module towctrans for portability");
1210# endif
1211#endif
1212
1213_GL_INLINE_HEADER_END
1214
1215#endif /* _GL_WCTYPE_H */
1216#endif /* _GL_WCTYPE_H */
1217#endif
1218