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 <wchar.h>, for platforms that have issues.
7
8   Copyright (C) 2007-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 Eric Blake.  */
24
25/*
26 * ISO C 99 <wchar.h> for platforms that have issues.
27 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html>
28 *
29 * For now, this just ensures proper prerequisite inclusion order and
30 * the declaration of wcwidth().
31 */
32
33#if __GNUC__ >= 3
34#pragma GCC system_header
35#endif
36
37
38#if (((defined __need_mbstate_t || defined __need_wint_t)               \
39      && !defined __MINGW32__)                                          \
40     || (defined __hpux                                                 \
41         && ((defined _INTTYPES_INCLUDED                                \
42              && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H)     \
43             || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
44     || (defined __MINGW32__ && defined __STRING_H_SOURCED__)           \
45     || defined _GL_ALREADY_INCLUDING_WCHAR_H)
46/* Special invocation convention:
47   - Inside glibc and uClibc header files, but not MinGW.
48   - On HP-UX 11.00 we have a sequence of nested includes
49     <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
50     once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
51     and once directly.  In both situations 'wint_t' is not yet defined,
52     therefore we cannot provide the function overrides; instead include only
53     the system's <wchar.h>.
54   - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of
55     <wchar.h> is actually processed, and that doesn't include 'mbstate_t'.
56   - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
57     the latter includes <wchar.h>.  But here, we have no way to detect whether
58     <wctype.h> is completely included or is still being included.  */
59
60#include_next <wchar.h>
61
62#else
63/* Normal invocation convention.  */
64
65#ifndef _GL_WCHAR_H
66
67#define _GL_ALREADY_INCLUDING_WCHAR_H
68
69#if 0
70# include <features.h> /* for __GLIBC__ */
71#endif
72
73/* In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
74   by <stddef.h>.
75   But avoid namespace pollution on glibc systems.  */
76#if !(defined __GLIBC__ && !defined __UCLIBC__)
77# include <stddef.h>
78#endif
79
80/* Include the original <wchar.h> if it exists.
81   Some builds of uClibc lack it.  */
82/* The include_next requires a split double-inclusion guard.  */
83#if 1
84# include_next <wchar.h>
85#endif
86
87#undef _GL_ALREADY_INCLUDING_WCHAR_H
88
89#ifndef _GL_WCHAR_H
90#define _GL_WCHAR_H
91
92/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
93   that can be freed by passing them as the Ith argument to the
94   function F.  */
95#ifndef _GL_ATTRIBUTE_DEALLOC
96# if __GNUC__ >= 11
97#  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
98# else
99#  define _GL_ATTRIBUTE_DEALLOC(f, i)
100# endif
101#endif
102
103/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
104   can be freed via 'free'; it can be used only after declaring 'free'.  */
105/* Applies to: functions.  Cannot be used on inline functions.  */
106#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
107# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
108#endif
109
110/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
111   allocated memory.  */
112/* Applies to: functions.  */
113#ifndef _GL_ATTRIBUTE_MALLOC
114# if __GNUC__ >= 3 || defined __clang__
115#  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
116# else
117#  define _GL_ATTRIBUTE_MALLOC
118# endif
119#endif
120
121/* The __attribute__ feature is available in gcc versions 2.5 and later.
122   The attribute __pure__ was added in gcc 2.96.  */
123#ifndef _GL_ATTRIBUTE_PURE
124# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
125#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
126# else
127#  define _GL_ATTRIBUTE_PURE /* empty */
128# endif
129#endif
130
131/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
132/* C++ compatible function declaration macros.
133   Copyright (C) 2010-2022 Free Software Foundation, Inc.
134
135   This program is free software: you can redistribute it and/or modify it
136   under the terms of the GNU Lesser General Public License as published
137   by the Free Software Foundation; either version 2 of the License, or
138   (at your option) any later version.
139
140   This program is distributed in the hope that it will be useful,
141   but WITHOUT ANY WARRANTY; without even the implied warranty of
142   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
143   Lesser General Public License for more details.
144
145   You should have received a copy of the GNU Lesser General Public License
146   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
147
148#ifndef _GL_CXXDEFS_H
149#define _GL_CXXDEFS_H
150
151/* Begin/end the GNULIB_NAMESPACE namespace.  */
152#if defined __cplusplus && defined GNULIB_NAMESPACE
153# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
154# define _GL_END_NAMESPACE }
155#else
156# define _GL_BEGIN_NAMESPACE
157# define _GL_END_NAMESPACE
158#endif
159
160/* The three most frequent use cases of these macros are:
161
162   * For providing a substitute for a function that is missing on some
163     platforms, but is declared and works fine on the platforms on which
164     it exists:
165
166       #if @GNULIB_FOO@
167       # if !@HAVE_FOO@
168       _GL_FUNCDECL_SYS (foo, ...);
169       # endif
170       _GL_CXXALIAS_SYS (foo, ...);
171       _GL_CXXALIASWARN (foo);
172       #elif defined GNULIB_POSIXCHECK
173       ...
174       #endif
175
176   * For providing a replacement for a function that exists on all platforms,
177     but is broken/insufficient and needs to be replaced on some platforms:
178
179       #if @GNULIB_FOO@
180       # if @REPLACE_FOO@
181       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
182       #   undef foo
183       #   define foo rpl_foo
184       #  endif
185       _GL_FUNCDECL_RPL (foo, ...);
186       _GL_CXXALIAS_RPL (foo, ...);
187       # else
188       _GL_CXXALIAS_SYS (foo, ...);
189       # endif
190       _GL_CXXALIASWARN (foo);
191       #elif defined GNULIB_POSIXCHECK
192       ...
193       #endif
194
195   * For providing a replacement for a function that exists on some platforms
196     but is broken/insufficient and needs to be replaced on some of them and
197     is additionally either missing or undeclared on some other platforms:
198
199       #if @GNULIB_FOO@
200       # if @REPLACE_FOO@
201       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
202       #   undef foo
203       #   define foo rpl_foo
204       #  endif
205       _GL_FUNCDECL_RPL (foo, ...);
206       _GL_CXXALIAS_RPL (foo, ...);
207       # else
208       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
209       _GL_FUNCDECL_SYS (foo, ...);
210       #  endif
211       _GL_CXXALIAS_SYS (foo, ...);
212       # endif
213       _GL_CXXALIASWARN (foo);
214       #elif defined GNULIB_POSIXCHECK
215       ...
216       #endif
217*/
218
219/* _GL_EXTERN_C declaration;
220   performs the declaration with C linkage.  */
221#if defined __cplusplus
222# define _GL_EXTERN_C extern "C"
223#else
224# define _GL_EXTERN_C extern
225#endif
226
227/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
228   declares a replacement function, named rpl_func, with the given prototype,
229   consisting of return type, parameters, and attributes.
230   Example:
231     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
232                                  _GL_ARG_NONNULL ((1)));
233 */
234#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
235  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
236#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
237  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
238
239/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
240   declares the system function, named func, with the given prototype,
241   consisting of return type, parameters, and attributes.
242   Example:
243     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
244                                  _GL_ARG_NONNULL ((1)));
245 */
246#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
247  _GL_EXTERN_C rettype func parameters_and_attributes
248
249/* _GL_CXXALIAS_RPL (func, rettype, parameters);
250   declares a C++ alias called GNULIB_NAMESPACE::func
251   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
252   Example:
253     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
254
255   Wrapping rpl_func in an object with an inline conversion operator
256   avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
257   actually used in the program.  */
258#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
259  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
260#if defined __cplusplus && defined GNULIB_NAMESPACE
261# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
262    namespace GNULIB_NAMESPACE                                \
263    {                                                         \
264      static const struct _gl_ ## func ## _wrapper            \
265      {                                                       \
266        typedef rettype (*type) parameters;                   \
267                                                              \
268        inline operator type () const                         \
269        {                                                     \
270          return ::rpl_func;                                  \
271        }                                                     \
272      } func = {};                                            \
273    }                                                         \
274    _GL_EXTERN_C int _gl_cxxalias_dummy
275#else
276# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
277    _GL_EXTERN_C int _gl_cxxalias_dummy
278#endif
279
280/* _GL_CXXALIAS_MDA (func, rettype, parameters);
281   is to be used when func is a Microsoft deprecated alias, on native Windows.
282   It declares a C++ alias called GNULIB_NAMESPACE::func
283   that redirects to _func, if GNULIB_NAMESPACE is defined.
284   Example:
285     _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
286 */
287#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
288  _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
289
290/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
291   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
292   except that the C function rpl_func may have a slightly different
293   declaration.  A cast is used to silence the "invalid conversion" error
294   that would otherwise occur.  */
295#if defined __cplusplus && defined GNULIB_NAMESPACE
296# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
297    namespace GNULIB_NAMESPACE                                     \
298    {                                                              \
299      static const struct _gl_ ## func ## _wrapper                 \
300      {                                                            \
301        typedef rettype (*type) parameters;                        \
302                                                                   \
303        inline operator type () const                              \
304        {                                                          \
305          return reinterpret_cast<type>(::rpl_func);               \
306        }                                                          \
307      } func = {};                                                 \
308    }                                                              \
309    _GL_EXTERN_C int _gl_cxxalias_dummy
310#else
311# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
312    _GL_EXTERN_C int _gl_cxxalias_dummy
313#endif
314
315/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
316   is like  _GL_CXXALIAS_MDA (func, rettype, parameters);
317   except that the C function func may have a slightly different declaration.
318   A cast is used to silence the "invalid conversion" error that would
319   otherwise occur.  */
320#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
321  _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
322
323/* _GL_CXXALIAS_SYS (func, rettype, parameters);
324   declares a C++ alias called GNULIB_NAMESPACE::func
325   that redirects to the system provided function func, if GNULIB_NAMESPACE
326   is defined.
327   Example:
328     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
329
330   Wrapping func in an object with an inline conversion operator
331   avoids a reference to func unless GNULIB_NAMESPACE::func is
332   actually used in the program.  */
333#if defined __cplusplus && defined GNULIB_NAMESPACE
334# define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
335    namespace GNULIB_NAMESPACE                                \
336    {                                                         \
337      static const struct _gl_ ## func ## _wrapper            \
338      {                                                       \
339        typedef rettype (*type) parameters;                   \
340                                                              \
341        inline operator type () const                         \
342        {                                                     \
343          return ::func;                                      \
344        }                                                     \
345      } func = {};                                            \
346    }                                                         \
347    _GL_EXTERN_C int _gl_cxxalias_dummy
348#else
349# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
350    _GL_EXTERN_C int _gl_cxxalias_dummy
351#endif
352
353/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
354   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
355   except that the C function func may have a slightly different declaration.
356   A cast is used to silence the "invalid conversion" error that would
357   otherwise occur.  */
358#if defined __cplusplus && defined GNULIB_NAMESPACE
359# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
360    namespace GNULIB_NAMESPACE                          \
361    {                                                   \
362      static const struct _gl_ ## func ## _wrapper      \
363      {                                                 \
364        typedef rettype (*type) parameters;             \
365                                                        \
366        inline operator type () const                   \
367        {                                               \
368          return reinterpret_cast<type>(::func);        \
369        }                                               \
370      } func = {};                                      \
371    }                                                   \
372    _GL_EXTERN_C int _gl_cxxalias_dummy
373#else
374# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
375    _GL_EXTERN_C int _gl_cxxalias_dummy
376#endif
377
378/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
379   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
380   except that the C function is picked among a set of overloaded functions,
381   namely the one with rettype2 and parameters2.  Two consecutive casts
382   are used to silence the "cannot find a match" and "invalid conversion"
383   errors that would otherwise occur.  */
384#if defined __cplusplus && defined GNULIB_NAMESPACE
385  /* The outer cast must be a reinterpret_cast.
386     The inner cast: When the function is defined as a set of overloaded
387     functions, it works as a static_cast<>, choosing the designated variant.
388     When the function is defined as a single variant, it works as a
389     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
390# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
391    namespace GNULIB_NAMESPACE                                                \
392    {                                                                         \
393      static const struct _gl_ ## func ## _wrapper                            \
394      {                                                                       \
395        typedef rettype (*type) parameters;                                   \
396                                                                              \
397        inline operator type () const                                         \
398        {                                                                     \
399          return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
400        }                                                                     \
401      } func = {};                                                            \
402    }                                                                         \
403    _GL_EXTERN_C int _gl_cxxalias_dummy
404#else
405# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
406    _GL_EXTERN_C int _gl_cxxalias_dummy
407#endif
408
409/* _GL_CXXALIASWARN (func);
410   causes a warning to be emitted when ::func is used but not when
411   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
412   variants.  */
413#if defined __cplusplus && defined GNULIB_NAMESPACE
414# define _GL_CXXALIASWARN(func) \
415   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
416# define _GL_CXXALIASWARN_1(func,namespace) \
417   _GL_CXXALIASWARN_2 (func, namespace)
418/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
419   we enable the warning only when not optimizing.  */
420# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
421#  define _GL_CXXALIASWARN_2(func,namespace) \
422    _GL_WARN_ON_USE (func, \
423                     "The symbol ::" #func " refers to the system function. " \
424                     "Use " #namespace "::" #func " instead.")
425# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
426#  define _GL_CXXALIASWARN_2(func,namespace) \
427     extern __typeof__ (func) func
428# else
429#  define _GL_CXXALIASWARN_2(func,namespace) \
430     _GL_EXTERN_C int _gl_cxxalias_dummy
431# endif
432#else
433# define _GL_CXXALIASWARN(func) \
434    _GL_EXTERN_C int _gl_cxxalias_dummy
435#endif
436
437/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
438   causes a warning to be emitted when the given overloaded variant of ::func
439   is used but not when GNULIB_NAMESPACE::func is used.  */
440#if defined __cplusplus && defined GNULIB_NAMESPACE
441# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
442   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
443                        GNULIB_NAMESPACE)
444# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
445   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
446/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
447   we enable the warning only when not optimizing.  */
448# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
449#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
450    _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
451                         "The symbol ::" #func " refers to the system function. " \
452                         "Use " #namespace "::" #func " instead.")
453# else
454#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
455     _GL_EXTERN_C int _gl_cxxalias_dummy
456# endif
457#else
458# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
459    _GL_EXTERN_C int _gl_cxxalias_dummy
460#endif
461
462#endif /* _GL_CXXDEFS_H */
463
464/* The definition of _GL_ARG_NONNULL is copied here.  */
465/* A C macro for declaring that specific arguments must not be NULL.
466   Copyright (C) 2009-2022 Free Software Foundation, Inc.
467
468   This program is free software: you can redistribute it and/or modify it
469   under the terms of the GNU Lesser General Public License as published
470   by the Free Software Foundation; either version 2 of the License, or
471   (at your option) any later version.
472
473   This program is distributed in the hope that it will be useful,
474   but WITHOUT ANY WARRANTY; without even the implied warranty of
475   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
476   Lesser General Public License for more details.
477
478   You should have received a copy of the GNU Lesser General Public License
479   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
480
481/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
482   that the values passed as arguments n, ..., m must be non-NULL pointers.
483   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
484#ifndef _GL_ARG_NONNULL
485# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
486#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
487# else
488#  define _GL_ARG_NONNULL(params)
489# endif
490#endif
491
492/* The definition of _GL_WARN_ON_USE is copied here.  */
493/* A C macro for emitting warnings if a function is used.
494   Copyright (C) 2010-2022 Free Software Foundation, Inc.
495
496   This program is free software: you can redistribute it and/or modify it
497   under the terms of the GNU Lesser General Public License as published
498   by the Free Software Foundation; either version 2 of the License, or
499   (at your option) any later version.
500
501   This program is distributed in the hope that it will be useful,
502   but WITHOUT ANY WARRANTY; without even the implied warranty of
503   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
504   Lesser General Public License for more details.
505
506   You should have received a copy of the GNU Lesser General Public License
507   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
508
509/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
510   for FUNCTION which will then trigger a compiler warning containing
511   the text of "literal string" anywhere that function is called, if
512   supported by the compiler.  If the compiler does not support this
513   feature, the macro expands to an unused extern declaration.
514
515   _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
516   attribute used in _GL_WARN_ON_USE.  If the compiler does not support
517   this feature, it expands to empty.
518
519   These macros are useful for marking a function as a potential
520   portability trap, with the intent that "literal string" include
521   instructions on the replacement function that should be used
522   instead.
523   _GL_WARN_ON_USE is for functions with 'extern' linkage.
524   _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
525   linkage.
526
527   However, one of the reasons that a function is a portability trap is
528   if it has the wrong signature.  Declaring FUNCTION with a different
529   signature in C is a compilation error, so this macro must use the
530   same type as any existing declaration so that programs that avoid
531   the problematic FUNCTION do not fail to compile merely because they
532   included a header that poisoned the function.  But this implies that
533   _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
534   have a declaration.  Use of this macro implies that there must not
535   be any other macro hiding the declaration of FUNCTION; but
536   undefining FUNCTION first is part of the poisoning process anyway
537   (although for symbols that are provided only via a macro, the result
538   is a compilation error rather than a warning containing
539   "literal string").  Also note that in C++, it is only safe to use if
540   FUNCTION has no overloads.
541
542   For an example, it is possible to poison 'getline' by:
543   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
544     [getline]) in configure.ac, which potentially defines
545     HAVE_RAW_DECL_GETLINE
546   - adding this code to a header that wraps the system <stdio.h>:
547     #undef getline
548     #if HAVE_RAW_DECL_GETLINE
549     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
550       "not universally present; use the gnulib module getline");
551     #endif
552
553   It is not possible to directly poison global variables.  But it is
554   possible to write a wrapper accessor function, and poison that
555   (less common usage, like &environ, will cause a compilation error
556   rather than issue the nice warning, but the end result of informing
557   the developer about their portability problem is still achieved):
558     #if HAVE_RAW_DECL_ENVIRON
559     static char ***
560     rpl_environ (void) { return &environ; }
561     _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
562     # undef environ
563     # define environ (*rpl_environ ())
564     #endif
565   or better (avoiding contradictory use of 'static' and 'extern'):
566     #if HAVE_RAW_DECL_ENVIRON
567     static char ***
568     _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
569     rpl_environ (void) { return &environ; }
570     # undef environ
571     # define environ (*rpl_environ ())
572     #endif
573   */
574#ifndef _GL_WARN_ON_USE
575
576# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
577/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
578#  define _GL_WARN_ON_USE(function, message) \
579_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
580#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
581  __attribute__ ((__warning__ (message)))
582# elif __clang_major__ >= 4
583/* Another compiler attribute is available in clang.  */
584#  define _GL_WARN_ON_USE(function, message) \
585_GL_WARN_EXTERN_C __typeof__ (function) function \
586  __attribute__ ((__diagnose_if__ (1, message, "warning")))
587#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
588  __attribute__ ((__diagnose_if__ (1, message, "warning")))
589# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
590/* Verify the existence of the function.  */
591#  define _GL_WARN_ON_USE(function, message) \
592_GL_WARN_EXTERN_C __typeof__ (function) function
593#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
594# else /* Unsupported.  */
595#  define _GL_WARN_ON_USE(function, message) \
596_GL_WARN_EXTERN_C int _gl_warn_on_use
597#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
598# endif
599#endif
600
601/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
602   is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
603   function is declared with the given prototype, consisting of return type,
604   parameters, and attributes.
605   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
606   not work in this case.  */
607#ifndef _GL_WARN_ON_USE_CXX
608# if !defined __cplusplus
609#  define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
610     _GL_WARN_ON_USE (function, msg)
611# else
612#  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
613/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
614#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
615extern rettype_gcc function parameters_and_attributes \
616  __attribute__ ((__warning__ (msg)))
617#  elif __clang_major__ >= 4
618/* Another compiler attribute is available in clang.  */
619#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
620extern rettype_clang function parameters_and_attributes \
621  __attribute__ ((__diagnose_if__ (1, msg, "warning")))
622#  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
623/* Verify the existence of the function.  */
624#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
625extern rettype_gcc function parameters_and_attributes
626#  else /* Unsupported.  */
627#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
628_GL_WARN_EXTERN_C int _gl_warn_on_use
629#  endif
630# endif
631#endif
632
633/* _GL_WARN_EXTERN_C declaration;
634   performs the declaration with C linkage.  */
635#ifndef _GL_WARN_EXTERN_C
636# if defined __cplusplus
637#  define _GL_WARN_EXTERN_C extern "C"
638# else
639#  define _GL_WARN_EXTERN_C extern
640# endif
641#endif
642
643
644/* Define wint_t and WEOF.  (Also done in wctype.in.h.)  */
645#if !1 && !defined wint_t
646# define wint_t int
647# ifndef WEOF
648#  define WEOF -1
649# endif
650#else
651/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
652   <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
653   wint_t must be "unchanged by default argument promotions".  Override it.  */
654# if 0
655#  if !GNULIB_defined_wint_t
656#   if 0
657#    include <crtdefs.h>
658#   else
659#    include <stddef.h>
660#   endif
661typedef unsigned int rpl_wint_t;
662#   undef wint_t
663#   define wint_t rpl_wint_t
664#   define GNULIB_defined_wint_t 1
665#  endif
666# endif
667# ifndef WEOF
668#  define WEOF ((wint_t) -1)
669# endif
670#endif
671
672
673/* Override mbstate_t if it is too small.
674   On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
675   implementing mbrtowc for encodings like UTF-8.
676   On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is
677   large enough and overriding it would cause problems in C++ mode.  */
678#if !(((defined _WIN32 && !defined __CYGWIN__) || 1) && 1) || 0
679# if !GNULIB_defined_mbstate_t
680#  if !(defined _AIX || defined _MSC_VER)
681typedef int rpl_mbstate_t;
682#   undef mbstate_t
683#   define mbstate_t rpl_mbstate_t
684#  endif
685#  define GNULIB_defined_mbstate_t 1
686# endif
687#endif
688
689/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
690   been included yet.  */
691#if 1
692# if (1 && !defined free \
693      && !(defined __cplusplus && defined GNULIB_NAMESPACE))
694/* We can't do '#define free rpl_free' here.  */
695_GL_EXTERN_C void rpl_free (void *);
696#  undef _GL_ATTRIBUTE_DEALLOC_FREE
697#  define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
698# else
699#  if defined _MSC_VER
700_GL_EXTERN_C void __cdecl free (void *);
701#  else
702#   if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
703_GL_EXTERN_C void free (void *) throw ();
704#   else
705_GL_EXTERN_C void free (void *);
706#   endif
707#  endif
708# endif
709#else
710# if defined _MSC_VER
711_GL_EXTERN_C void __cdecl free (void *);
712# else
713#  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
714_GL_EXTERN_C void free (void *) throw ();
715#  else
716_GL_EXTERN_C void free (void *);
717#  endif
718# endif
719#endif
720
721/* Convert a single-byte character to a wide character.  */
722#if 1
723# if 0
724#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
725#   undef btowc
726#   define btowc rpl_btowc
727#  endif
728_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
729_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
730# else
731#  if !1
732_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
733#  endif
734/* Need to cast, because on mingw, the return type is 'unsigned short'.  */
735_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
736# endif
737# if __GLIBC__ >= 2
738_GL_CXXALIASWARN (btowc);
739# endif
740#elif defined GNULIB_POSIXCHECK
741# undef btowc
742# if HAVE_RAW_DECL_BTOWC
743_GL_WARN_ON_USE (btowc, "btowc is unportable - "
744                 "use gnulib module btowc for portability");
745# endif
746#endif
747
748
749/* Convert a wide character to a single-byte character.  */
750#if 0
751# if 0
752#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
753#   undef wctob
754#   define wctob rpl_wctob
755#  endif
756_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
757_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
758# else
759#  if !defined wctob && !1
760/* wctob is provided by gnulib, or wctob exists but is not declared.  */
761_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
762#  endif
763_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
764# endif
765# if __GLIBC__ >= 2
766_GL_CXXALIASWARN (wctob);
767# endif
768#elif defined GNULIB_POSIXCHECK
769# undef wctob
770# if HAVE_RAW_DECL_WCTOB
771_GL_WARN_ON_USE (wctob, "wctob is unportable - "
772                 "use gnulib module wctob for portability");
773# endif
774#endif
775
776
777/* Test whether *PS is in the initial state.  */
778#if 1
779# if 0
780#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
781#   undef mbsinit
782#   define mbsinit rpl_mbsinit
783#  endif
784_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
785_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
786# else
787#  if !1
788_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
789#  endif
790_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
791# endif
792# if __GLIBC__ >= 2
793_GL_CXXALIASWARN (mbsinit);
794# endif
795#elif defined GNULIB_POSIXCHECK
796# undef mbsinit
797# if HAVE_RAW_DECL_MBSINIT
798_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
799                 "use gnulib module mbsinit for portability");
800# endif
801#endif
802
803
804/* Convert a multibyte character to a wide character.  */
805#if 1
806# if 1
807#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
808#   undef mbrtowc
809#   define mbrtowc rpl_mbrtowc
810#  endif
811_GL_FUNCDECL_RPL (mbrtowc, size_t,
812                  (wchar_t *restrict pwc, const char *restrict s, size_t n,
813                   mbstate_t *restrict ps));
814_GL_CXXALIAS_RPL (mbrtowc, size_t,
815                  (wchar_t *restrict pwc, const char *restrict s, size_t n,
816                   mbstate_t *restrict ps));
817# else
818#  if !1
819_GL_FUNCDECL_SYS (mbrtowc, size_t,
820                  (wchar_t *restrict pwc, const char *restrict s, size_t n,
821                   mbstate_t *restrict ps));
822#  endif
823_GL_CXXALIAS_SYS (mbrtowc, size_t,
824                  (wchar_t *restrict pwc, const char *restrict s, size_t n,
825                   mbstate_t *restrict ps));
826# endif
827# if __GLIBC__ >= 2
828_GL_CXXALIASWARN (mbrtowc);
829# endif
830#elif defined GNULIB_POSIXCHECK
831# undef mbrtowc
832# if HAVE_RAW_DECL_MBRTOWC
833_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
834                 "use gnulib module mbrtowc for portability");
835# endif
836#endif
837
838
839/* Recognize a multibyte character.  */
840#if 0
841# if 0
842#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
843#   undef mbrlen
844#   define mbrlen rpl_mbrlen
845#  endif
846_GL_FUNCDECL_RPL (mbrlen, size_t,
847                  (const char *restrict s, size_t n, mbstate_t *restrict ps));
848_GL_CXXALIAS_RPL (mbrlen, size_t,
849                  (const char *restrict s, size_t n, mbstate_t *restrict ps));
850# else
851#  if !1
852_GL_FUNCDECL_SYS (mbrlen, size_t,
853                  (const char *restrict s, size_t n, mbstate_t *restrict ps));
854#  endif
855_GL_CXXALIAS_SYS (mbrlen, size_t,
856                  (const char *restrict s, size_t n, mbstate_t *restrict ps));
857# endif
858# if __GLIBC__ >= 2
859_GL_CXXALIASWARN (mbrlen);
860# endif
861#elif defined GNULIB_POSIXCHECK
862# undef mbrlen
863# if HAVE_RAW_DECL_MBRLEN
864_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
865                 "use gnulib module mbrlen for portability");
866# endif
867#endif
868
869
870/* Convert a string to a wide string.  */
871#if 1
872# if 0
873#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
874#   undef mbsrtowcs
875#   define mbsrtowcs rpl_mbsrtowcs
876#  endif
877_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
878                  (wchar_t *restrict dest,
879                   const char **restrict srcp, size_t len,
880                   mbstate_t *restrict ps)
881                  _GL_ARG_NONNULL ((2)));
882_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
883                  (wchar_t *restrict dest,
884                   const char **restrict srcp, size_t len,
885                   mbstate_t *restrict ps));
886# else
887#  if !1
888_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
889                  (wchar_t *restrict dest,
890                   const char **restrict srcp, size_t len,
891                   mbstate_t *restrict ps)
892                  _GL_ARG_NONNULL ((2)));
893#  endif
894_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
895                  (wchar_t *restrict dest,
896                   const char **restrict srcp, size_t len,
897                   mbstate_t *restrict ps));
898# endif
899# if __GLIBC__ >= 2
900_GL_CXXALIASWARN (mbsrtowcs);
901# endif
902#elif defined GNULIB_POSIXCHECK
903# undef mbsrtowcs
904# if HAVE_RAW_DECL_MBSRTOWCS
905_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
906                 "use gnulib module mbsrtowcs for portability");
907# endif
908#endif
909
910
911/* Convert a string to a wide string.  */
912#if 0
913# if 0
914#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
915#   undef mbsnrtowcs
916#   define mbsnrtowcs rpl_mbsnrtowcs
917#  endif
918_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
919                  (wchar_t *restrict dest,
920                   const char **restrict srcp, size_t srclen, size_t len,
921                   mbstate_t *restrict ps)
922                  _GL_ARG_NONNULL ((2)));
923_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
924                  (wchar_t *restrict dest,
925                   const char **restrict srcp, size_t srclen, size_t len,
926                   mbstate_t *restrict ps));
927# else
928#  if !1
929_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
930                  (wchar_t *restrict dest,
931                   const char **restrict srcp, size_t srclen, size_t len,
932                   mbstate_t *restrict ps)
933                  _GL_ARG_NONNULL ((2)));
934#  endif
935_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
936                  (wchar_t *restrict dest,
937                   const char **restrict srcp, size_t srclen, size_t len,
938                   mbstate_t *restrict ps));
939# endif
940_GL_CXXALIASWARN (mbsnrtowcs);
941#elif defined GNULIB_POSIXCHECK
942# undef mbsnrtowcs
943# if HAVE_RAW_DECL_MBSNRTOWCS
944_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
945                 "use gnulib module mbsnrtowcs for portability");
946# endif
947#endif
948
949
950/* Convert a wide character to a multibyte character.  */
951#if 0
952# if 0
953#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
954#   undef wcrtomb
955#   define wcrtomb rpl_wcrtomb
956#  endif
957_GL_FUNCDECL_RPL (wcrtomb, size_t,
958                  (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
959_GL_CXXALIAS_RPL (wcrtomb, size_t,
960                  (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
961# else
962#  if !1
963_GL_FUNCDECL_SYS (wcrtomb, size_t,
964                  (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
965#  endif
966_GL_CXXALIAS_SYS (wcrtomb, size_t,
967                  (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
968# endif
969# if __GLIBC__ >= 2
970_GL_CXXALIASWARN (wcrtomb);
971# endif
972#elif defined GNULIB_POSIXCHECK
973# undef wcrtomb
974# if HAVE_RAW_DECL_WCRTOMB
975_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
976                 "use gnulib module wcrtomb for portability");
977# endif
978#endif
979
980
981/* Convert a wide string to a string.  */
982#if 0
983# if 0
984#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
985#   undef wcsrtombs
986#   define wcsrtombs rpl_wcsrtombs
987#  endif
988_GL_FUNCDECL_RPL (wcsrtombs, size_t,
989                  (char *restrict dest, const wchar_t **restrict srcp,
990                   size_t len,
991                   mbstate_t *restrict ps)
992                  _GL_ARG_NONNULL ((2)));
993_GL_CXXALIAS_RPL (wcsrtombs, size_t,
994                  (char *restrict dest, const wchar_t **restrict srcp,
995                   size_t len,
996                   mbstate_t *restrict ps));
997# else
998#  if !1
999_GL_FUNCDECL_SYS (wcsrtombs, size_t,
1000                  (char *restrict dest, const wchar_t **restrict srcp,
1001                   size_t len,
1002                   mbstate_t *restrict ps)
1003                  _GL_ARG_NONNULL ((2)));
1004#  endif
1005_GL_CXXALIAS_SYS (wcsrtombs, size_t,
1006                  (char *restrict dest, const wchar_t **restrict srcp,
1007                   size_t len,
1008                   mbstate_t *restrict ps));
1009# endif
1010# if __GLIBC__ >= 2
1011_GL_CXXALIASWARN (wcsrtombs);
1012# endif
1013#elif defined GNULIB_POSIXCHECK
1014# undef wcsrtombs
1015# if HAVE_RAW_DECL_WCSRTOMBS
1016_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
1017                 "use gnulib module wcsrtombs for portability");
1018# endif
1019#endif
1020
1021
1022/* Convert a wide string to a string.  */
1023#if 0
1024# if 0
1025#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1026#   undef wcsnrtombs
1027#   define wcsnrtombs rpl_wcsnrtombs
1028#  endif
1029_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
1030                  (char *restrict dest,
1031                   const wchar_t **restrict srcp, size_t srclen,
1032                   size_t len,
1033                   mbstate_t *restrict ps)
1034                  _GL_ARG_NONNULL ((2)));
1035_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
1036                  (char *restrict dest,
1037                   const wchar_t **restrict srcp, size_t srclen,
1038                   size_t len,
1039                   mbstate_t *restrict ps));
1040# else
1041#  if !1 || (defined __cplusplus && defined __sun)
1042_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
1043                  (char *restrict dest,
1044                   const wchar_t **restrict srcp, size_t srclen,
1045                   size_t len,
1046                   mbstate_t *restrict ps)
1047                  _GL_ARG_NONNULL ((2)));
1048#  endif
1049_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
1050                  (char *restrict dest,
1051                   const wchar_t **restrict srcp, size_t srclen,
1052                   size_t len,
1053                   mbstate_t *restrict ps));
1054# endif
1055# if __GLIBC__ >= 2
1056_GL_CXXALIASWARN (wcsnrtombs);
1057# endif
1058#elif defined GNULIB_POSIXCHECK
1059# undef wcsnrtombs
1060# if HAVE_RAW_DECL_WCSNRTOMBS
1061_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
1062                 "use gnulib module wcsnrtombs for portability");
1063# endif
1064#endif
1065
1066
1067/* Return the number of screen columns needed for WC.  */
1068#if 0
1069# if 0
1070#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1071#   undef wcwidth
1072#   define wcwidth rpl_wcwidth
1073#  endif
1074_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
1075_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
1076# else
1077#  if !1
1078/* wcwidth exists but is not declared.  */
1079_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
1080#  endif
1081_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
1082# endif
1083# if __GLIBC__ >= 2
1084_GL_CXXALIASWARN (wcwidth);
1085# endif
1086#elif defined GNULIB_POSIXCHECK
1087# undef wcwidth
1088# if HAVE_RAW_DECL_WCWIDTH
1089_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
1090                 "use gnulib module wcwidth for portability");
1091# endif
1092#endif
1093
1094
1095/* Search N wide characters of S for C.  */
1096#if 1
1097# if !1
1098_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
1099                                      _GL_ATTRIBUTE_PURE);
1100# endif
1101  /* On some systems, this function is defined as an overloaded function:
1102       extern "C++" {
1103         const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
1104         wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
1105       }  */
1106_GL_CXXALIAS_SYS_CAST2 (wmemchr,
1107                        wchar_t *, (const wchar_t *, wchar_t, size_t),
1108                        const wchar_t *, (const wchar_t *, wchar_t, size_t));
1109# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1110     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1111_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
1112_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
1113                   (const wchar_t *s, wchar_t c, size_t n));
1114# elif __GLIBC__ >= 2
1115_GL_CXXALIASWARN (wmemchr);
1116# endif
1117#elif defined GNULIB_POSIXCHECK
1118# undef wmemchr
1119# if HAVE_RAW_DECL_WMEMCHR
1120_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
1121                 "use gnulib module wmemchr for portability");
1122# endif
1123#endif
1124
1125
1126/* Compare N wide characters of S1 and S2.  */
1127#if 0
1128# if !1
1129_GL_FUNCDECL_SYS (wmemcmp, int,
1130                  (const wchar_t *s1, const wchar_t *s2, size_t n)
1131                  _GL_ATTRIBUTE_PURE);
1132# endif
1133_GL_CXXALIAS_SYS (wmemcmp, int,
1134                  (const wchar_t *s1, const wchar_t *s2, size_t n));
1135# if __GLIBC__ >= 2
1136_GL_CXXALIASWARN (wmemcmp);
1137# endif
1138#elif defined GNULIB_POSIXCHECK
1139# undef wmemcmp
1140# if HAVE_RAW_DECL_WMEMCMP
1141_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
1142                 "use gnulib module wmemcmp for portability");
1143# endif
1144#endif
1145
1146
1147/* Copy N wide characters of SRC to DEST.  */
1148#if 0
1149# if !1
1150_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
1151                  (wchar_t *restrict dest,
1152                   const wchar_t *restrict src, size_t n));
1153# endif
1154_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
1155                  (wchar_t *restrict dest,
1156                   const wchar_t *restrict src, size_t n));
1157# if __GLIBC__ >= 2
1158_GL_CXXALIASWARN (wmemcpy);
1159# endif
1160#elif defined GNULIB_POSIXCHECK
1161# undef wmemcpy
1162# if HAVE_RAW_DECL_WMEMCPY
1163_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
1164                 "use gnulib module wmemcpy for portability");
1165# endif
1166#endif
1167
1168
1169/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
1170   overlapping memory areas.  */
1171#if 0
1172# if !1
1173_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
1174                  (wchar_t *dest, const wchar_t *src, size_t n));
1175# endif
1176_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
1177                  (wchar_t *dest, const wchar_t *src, size_t n));
1178# if __GLIBC__ >= 2
1179_GL_CXXALIASWARN (wmemmove);
1180# endif
1181#elif defined GNULIB_POSIXCHECK
1182# undef wmemmove
1183# if HAVE_RAW_DECL_WMEMMOVE
1184_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
1185                 "use gnulib module wmemmove for portability");
1186# endif
1187#endif
1188
1189
1190/* Copy N wide characters of SRC to DEST.
1191   Return pointer to wide characters after the last written wide character.  */
1192#if 1
1193# if !1
1194_GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
1195                  (wchar_t *restrict dest,
1196                   const wchar_t *restrict src, size_t n));
1197# endif
1198_GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
1199                  (wchar_t *restrict dest,
1200                   const wchar_t *restrict src, size_t n));
1201# if __GLIBC__ >= 2
1202_GL_CXXALIASWARN (wmempcpy);
1203# endif
1204#elif defined GNULIB_POSIXCHECK
1205# undef wmempcpy
1206# if HAVE_RAW_DECL_WMEMPCPY
1207_GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
1208                 "use gnulib module wmempcpy for portability");
1209# endif
1210#endif
1211
1212
1213/* Set N wide characters of S to C.  */
1214#if 0
1215# if !1
1216_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
1217# endif
1218_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
1219# if __GLIBC__ >= 2
1220_GL_CXXALIASWARN (wmemset);
1221# endif
1222#elif defined GNULIB_POSIXCHECK
1223# undef wmemset
1224# if HAVE_RAW_DECL_WMEMSET
1225_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
1226                 "use gnulib module wmemset for portability");
1227# endif
1228#endif
1229
1230
1231/* Return the number of wide characters in S.  */
1232#if 0
1233# if !1
1234_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
1235# endif
1236_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
1237# if __GLIBC__ >= 2
1238_GL_CXXALIASWARN (wcslen);
1239# endif
1240#elif defined GNULIB_POSIXCHECK
1241# undef wcslen
1242# if HAVE_RAW_DECL_WCSLEN
1243_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
1244                 "use gnulib module wcslen for portability");
1245# endif
1246#endif
1247
1248
1249/* Return the number of wide characters in S, but at most MAXLEN.  */
1250#if 0
1251# if !1
1252_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
1253                                   _GL_ATTRIBUTE_PURE);
1254# endif
1255_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
1256_GL_CXXALIASWARN (wcsnlen);
1257#elif defined GNULIB_POSIXCHECK
1258# undef wcsnlen
1259# if HAVE_RAW_DECL_WCSNLEN
1260_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
1261                 "use gnulib module wcsnlen for portability");
1262# endif
1263#endif
1264
1265
1266/* Copy SRC to DEST.  */
1267#if 0
1268# if !1
1269_GL_FUNCDECL_SYS (wcscpy, wchar_t *,
1270                  (wchar_t *restrict dest, const wchar_t *restrict src));
1271# endif
1272_GL_CXXALIAS_SYS (wcscpy, wchar_t *,
1273                  (wchar_t *restrict dest, const wchar_t *restrict src));
1274# if __GLIBC__ >= 2
1275_GL_CXXALIASWARN (wcscpy);
1276# endif
1277#elif defined GNULIB_POSIXCHECK
1278# undef wcscpy
1279# if HAVE_RAW_DECL_WCSCPY
1280_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
1281                 "use gnulib module wcscpy for portability");
1282# endif
1283#endif
1284
1285
1286/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST.  */
1287#if 0
1288# if !1
1289_GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
1290                  (wchar_t *restrict dest, const wchar_t *restrict src));
1291# endif
1292_GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
1293                  (wchar_t *restrict dest, const wchar_t *restrict src));
1294_GL_CXXALIASWARN (wcpcpy);
1295#elif defined GNULIB_POSIXCHECK
1296# undef wcpcpy
1297# if HAVE_RAW_DECL_WCPCPY
1298_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
1299                 "use gnulib module wcpcpy for portability");
1300# endif
1301#endif
1302
1303
1304/* Copy no more than N wide characters of SRC to DEST.  */
1305#if 0
1306# if !1
1307_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
1308                  (wchar_t *restrict dest,
1309                   const wchar_t *restrict src, size_t n));
1310# endif
1311_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
1312                  (wchar_t *restrict dest,
1313                   const wchar_t *restrict src, size_t n));
1314# if __GLIBC__ >= 2
1315_GL_CXXALIASWARN (wcsncpy);
1316# endif
1317#elif defined GNULIB_POSIXCHECK
1318# undef wcsncpy
1319# if HAVE_RAW_DECL_WCSNCPY
1320_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
1321                 "use gnulib module wcsncpy for portability");
1322# endif
1323#endif
1324
1325
1326/* Copy no more than N characters of SRC to DEST, returning the address of
1327   the last character written into DEST.  */
1328#if 0
1329# if !1
1330_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
1331                  (wchar_t *restrict dest,
1332                   const wchar_t *restrict src, size_t n));
1333# endif
1334_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
1335                  (wchar_t *restrict dest,
1336                   const wchar_t *restrict src, size_t n));
1337_GL_CXXALIASWARN (wcpncpy);
1338#elif defined GNULIB_POSIXCHECK
1339# undef wcpncpy
1340# if HAVE_RAW_DECL_WCPNCPY
1341_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
1342                 "use gnulib module wcpncpy for portability");
1343# endif
1344#endif
1345
1346
1347/* Append SRC onto DEST.  */
1348#if 0
1349# if !1
1350_GL_FUNCDECL_SYS (wcscat, wchar_t *,
1351                  (wchar_t *restrict dest, const wchar_t *restrict src));
1352# endif
1353_GL_CXXALIAS_SYS (wcscat, wchar_t *,
1354                  (wchar_t *restrict dest, const wchar_t *restrict src));
1355# if __GLIBC__ >= 2
1356_GL_CXXALIASWARN (wcscat);
1357# endif
1358#elif defined GNULIB_POSIXCHECK
1359# undef wcscat
1360# if HAVE_RAW_DECL_WCSCAT
1361_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
1362                 "use gnulib module wcscat for portability");
1363# endif
1364#endif
1365
1366
1367/* Append no more than N wide characters of SRC onto DEST.  */
1368#if 0
1369# if !1
1370_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
1371                  (wchar_t *restrict dest, const wchar_t *restrict src,
1372                   size_t n));
1373# endif
1374_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
1375                  (wchar_t *restrict dest, const wchar_t *restrict src,
1376                   size_t n));
1377# if __GLIBC__ >= 2
1378_GL_CXXALIASWARN (wcsncat);
1379# endif
1380#elif defined GNULIB_POSIXCHECK
1381# undef wcsncat
1382# if HAVE_RAW_DECL_WCSNCAT
1383_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
1384                 "use gnulib module wcsncat for portability");
1385# endif
1386#endif
1387
1388
1389/* Compare S1 and S2.  */
1390#if 0
1391# if !1
1392_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
1393                               _GL_ATTRIBUTE_PURE);
1394# endif
1395_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
1396# if __GLIBC__ >= 2
1397_GL_CXXALIASWARN (wcscmp);
1398# endif
1399#elif defined GNULIB_POSIXCHECK
1400# undef wcscmp
1401# if HAVE_RAW_DECL_WCSCMP
1402_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
1403                 "use gnulib module wcscmp for portability");
1404# endif
1405#endif
1406
1407
1408/* Compare no more than N wide characters of S1 and S2.  */
1409#if 0
1410# if !1
1411_GL_FUNCDECL_SYS (wcsncmp, int,
1412                  (const wchar_t *s1, const wchar_t *s2, size_t n)
1413                  _GL_ATTRIBUTE_PURE);
1414# endif
1415_GL_CXXALIAS_SYS (wcsncmp, int,
1416                  (const wchar_t *s1, const wchar_t *s2, size_t n));
1417# if __GLIBC__ >= 2
1418_GL_CXXALIASWARN (wcsncmp);
1419# endif
1420#elif defined GNULIB_POSIXCHECK
1421# undef wcsncmp
1422# if HAVE_RAW_DECL_WCSNCMP
1423_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
1424                 "use gnulib module wcsncmp for portability");
1425# endif
1426#endif
1427
1428
1429/* Compare S1 and S2, ignoring case.  */
1430#if 0
1431# if !1
1432_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
1433                                   _GL_ATTRIBUTE_PURE);
1434# endif
1435_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
1436_GL_CXXALIASWARN (wcscasecmp);
1437#elif defined GNULIB_POSIXCHECK
1438# undef wcscasecmp
1439# if HAVE_RAW_DECL_WCSCASECMP
1440_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
1441                 "use gnulib module wcscasecmp for portability");
1442# endif
1443#endif
1444
1445
1446/* Compare no more than N chars of S1 and S2, ignoring case.  */
1447#if 0
1448# if !1
1449_GL_FUNCDECL_SYS (wcsncasecmp, int,
1450                  (const wchar_t *s1, const wchar_t *s2, size_t n)
1451                  _GL_ATTRIBUTE_PURE);
1452# endif
1453_GL_CXXALIAS_SYS (wcsncasecmp, int,
1454                  (const wchar_t *s1, const wchar_t *s2, size_t n));
1455_GL_CXXALIASWARN (wcsncasecmp);
1456#elif defined GNULIB_POSIXCHECK
1457# undef wcsncasecmp
1458# if HAVE_RAW_DECL_WCSNCASECMP
1459_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
1460                 "use gnulib module wcsncasecmp for portability");
1461# endif
1462#endif
1463
1464
1465/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
1466   category of the current locale.  */
1467#if 0
1468# if !1
1469_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
1470# endif
1471_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
1472# if __GLIBC__ >= 2
1473_GL_CXXALIASWARN (wcscoll);
1474# endif
1475#elif defined GNULIB_POSIXCHECK
1476# undef wcscoll
1477# if HAVE_RAW_DECL_WCSCOLL
1478_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
1479                 "use gnulib module wcscoll for portability");
1480# endif
1481#endif
1482
1483
1484/* Transform S2 into array pointed to by S1 such that if wcscmp is applied
1485   to two transformed strings the result is the as applying 'wcscoll' to the
1486   original strings.  */
1487#if 0
1488# if !1
1489_GL_FUNCDECL_SYS (wcsxfrm, size_t,
1490                  (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
1491# endif
1492_GL_CXXALIAS_SYS (wcsxfrm, size_t,
1493                  (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
1494# if __GLIBC__ >= 2
1495_GL_CXXALIASWARN (wcsxfrm);
1496# endif
1497#elif defined GNULIB_POSIXCHECK
1498# undef wcsxfrm
1499# if HAVE_RAW_DECL_WCSXFRM
1500_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
1501                 "use gnulib module wcsxfrm for portability");
1502# endif
1503#endif
1504
1505
1506/* Duplicate S, returning an identical malloc'd string.  */
1507#if 0
1508# if defined _WIN32 && !defined __CYGWIN__
1509#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1510#   undef wcsdup
1511#   define wcsdup _wcsdup
1512#  endif
1513_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1514# else
1515#  if !1 || __GNUC__ >= 11
1516_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1517                  (const wchar_t *s)
1518                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1519#  endif
1520_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1521# endif
1522_GL_CXXALIASWARN (wcsdup);
1523#else
1524# if __GNUC__ >= 11 && !defined wcsdup
1525/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free.  */
1526_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1527                  (const wchar_t *s)
1528                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1529# endif
1530# if defined GNULIB_POSIXCHECK
1531#  undef wcsdup
1532#  if HAVE_RAW_DECL_WCSDUP
1533_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
1534                 "use gnulib module wcsdup for portability");
1535#  endif
1536# elif 1
1537/* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not
1538   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
1539   platforms by defining GNULIB_NAMESPACE::wcsdup always.  */
1540#  if defined _WIN32 && !defined __CYGWIN__
1541#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1542#    undef wcsdup
1543#    define wcsdup _wcsdup
1544#   endif
1545_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1546#  else
1547_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1548                  (const wchar_t *s)
1549                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1550#   if 1
1551_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1552#   endif
1553#  endif
1554#  if (defined _WIN32 && !defined __CYGWIN__) || 1
1555_GL_CXXALIASWARN (wcsdup);
1556#  endif
1557# endif
1558#endif
1559
1560
1561/* Find the first occurrence of WC in WCS.  */
1562#if 0
1563# if !1
1564_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
1565                                     _GL_ATTRIBUTE_PURE);
1566# endif
1567  /* On some systems, this function is defined as an overloaded function:
1568       extern "C++" {
1569         const wchar_t * std::wcschr (const wchar_t *, wchar_t);
1570         wchar_t * std::wcschr (wchar_t *, wchar_t);
1571       }  */
1572_GL_CXXALIAS_SYS_CAST2 (wcschr,
1573                        wchar_t *, (const wchar_t *, wchar_t),
1574                        const wchar_t *, (const wchar_t *, wchar_t));
1575# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1576     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1577_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
1578_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1579# elif __GLIBC__ >= 2
1580_GL_CXXALIASWARN (wcschr);
1581# endif
1582#elif defined GNULIB_POSIXCHECK
1583# undef wcschr
1584# if HAVE_RAW_DECL_WCSCHR
1585_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
1586                 "use gnulib module wcschr for portability");
1587# endif
1588#endif
1589
1590
1591/* Find the last occurrence of WC in WCS.  */
1592#if 0
1593# if !1
1594_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
1595                                      _GL_ATTRIBUTE_PURE);
1596# endif
1597  /* On some systems, this function is defined as an overloaded function:
1598       extern "C++" {
1599         const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
1600         wchar_t * std::wcsrchr (wchar_t *, wchar_t);
1601       }  */
1602_GL_CXXALIAS_SYS_CAST2 (wcsrchr,
1603                        wchar_t *, (const wchar_t *, wchar_t),
1604                        const wchar_t *, (const wchar_t *, wchar_t));
1605# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1606     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1607_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
1608_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1609# elif __GLIBC__ >= 2
1610_GL_CXXALIASWARN (wcsrchr);
1611# endif
1612#elif defined GNULIB_POSIXCHECK
1613# undef wcsrchr
1614# if HAVE_RAW_DECL_WCSRCHR
1615_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
1616                 "use gnulib module wcsrchr for portability");
1617# endif
1618#endif
1619
1620
1621/* Return the length of the initial segmet of WCS which consists entirely
1622   of wide characters not in REJECT.  */
1623#if 0
1624# if !1
1625_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
1626                                   _GL_ATTRIBUTE_PURE);
1627# endif
1628_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
1629# if __GLIBC__ >= 2
1630_GL_CXXALIASWARN (wcscspn);
1631# endif
1632#elif defined GNULIB_POSIXCHECK
1633# undef wcscspn
1634# if HAVE_RAW_DECL_WCSCSPN
1635_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
1636                 "use gnulib module wcscspn for portability");
1637# endif
1638#endif
1639
1640
1641/* Return the length of the initial segmet of WCS which consists entirely
1642   of wide characters in ACCEPT.  */
1643#if 0
1644# if !1
1645_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
1646                                  _GL_ATTRIBUTE_PURE);
1647# endif
1648_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
1649# if __GLIBC__ >= 2
1650_GL_CXXALIASWARN (wcsspn);
1651# endif
1652#elif defined GNULIB_POSIXCHECK
1653# undef wcsspn
1654# if HAVE_RAW_DECL_WCSSPN
1655_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
1656                 "use gnulib module wcsspn for portability");
1657# endif
1658#endif
1659
1660
1661/* Find the first occurrence in WCS of any character in ACCEPT.  */
1662#if 0
1663# if !1
1664_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
1665                  (const wchar_t *wcs, const wchar_t *accept)
1666                  _GL_ATTRIBUTE_PURE);
1667# endif
1668  /* On some systems, this function is defined as an overloaded function:
1669       extern "C++" {
1670         const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
1671         wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
1672       }  */
1673_GL_CXXALIAS_SYS_CAST2 (wcspbrk,
1674                        wchar_t *, (const wchar_t *, const wchar_t *),
1675                        const wchar_t *, (const wchar_t *, const wchar_t *));
1676# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1677     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1678_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
1679                   (wchar_t *wcs, const wchar_t *accept));
1680_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
1681                   (const wchar_t *wcs, const wchar_t *accept));
1682# elif __GLIBC__ >= 2
1683_GL_CXXALIASWARN (wcspbrk);
1684# endif
1685#elif defined GNULIB_POSIXCHECK
1686# undef wcspbrk
1687# if HAVE_RAW_DECL_WCSPBRK
1688_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
1689                 "use gnulib module wcspbrk for portability");
1690# endif
1691#endif
1692
1693
1694/* Find the first occurrence of NEEDLE in HAYSTACK.  */
1695#if 0
1696# if !1
1697_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
1698                  (const wchar_t *restrict haystack,
1699                   const wchar_t *restrict needle)
1700                  _GL_ATTRIBUTE_PURE);
1701# endif
1702  /* On some systems, this function is defined as an overloaded function:
1703       extern "C++" {
1704         const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
1705         wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
1706       }  */
1707_GL_CXXALIAS_SYS_CAST2 (wcsstr,
1708                        wchar_t *,
1709                        (const wchar_t *restrict, const wchar_t *restrict),
1710                        const wchar_t *,
1711                        (const wchar_t *restrict, const wchar_t *restrict));
1712# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1713     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1714_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
1715                   (wchar_t *restrict haystack,
1716                    const wchar_t *restrict needle));
1717_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
1718                   (const wchar_t *restrict haystack,
1719                    const wchar_t *restrict needle));
1720# elif __GLIBC__ >= 2
1721_GL_CXXALIASWARN (wcsstr);
1722# endif
1723#elif defined GNULIB_POSIXCHECK
1724# undef wcsstr
1725# if HAVE_RAW_DECL_WCSSTR
1726_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
1727                 "use gnulib module wcsstr for portability");
1728# endif
1729#endif
1730
1731
1732/* Divide WCS into tokens separated by characters in DELIM.  */
1733#if 0
1734# if 0
1735#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1736#   undef wcstok
1737#   define wcstok rpl_wcstok
1738#  endif
1739_GL_FUNCDECL_RPL (wcstok, wchar_t *,
1740                  (wchar_t *restrict wcs, const wchar_t *restrict delim,
1741                   wchar_t **restrict ptr));
1742_GL_CXXALIAS_RPL (wcstok, wchar_t *,
1743                  (wchar_t *restrict wcs, const wchar_t *restrict delim,
1744                   wchar_t **restrict ptr));
1745# else
1746#  if !1
1747_GL_FUNCDECL_SYS (wcstok, wchar_t *,
1748                  (wchar_t *restrict wcs, const wchar_t *restrict delim,
1749                   wchar_t **restrict ptr));
1750#  endif
1751_GL_CXXALIAS_SYS (wcstok, wchar_t *,
1752                  (wchar_t *restrict wcs, const wchar_t *restrict delim,
1753                   wchar_t **restrict ptr));
1754# endif
1755# if __GLIBC__ >= 2
1756_GL_CXXALIASWARN (wcstok);
1757# endif
1758#elif defined GNULIB_POSIXCHECK
1759# undef wcstok
1760# if HAVE_RAW_DECL_WCSTOK
1761_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
1762                 "use gnulib module wcstok for portability");
1763# endif
1764#endif
1765
1766
1767/* Determine number of column positions required for first N wide
1768   characters (or fewer if S ends before this) in S.  */
1769#if 0
1770# if 0
1771#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1772#   undef wcswidth
1773#   define wcswidth rpl_wcswidth
1774#  endif
1775_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
1776                                 _GL_ATTRIBUTE_PURE);
1777_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
1778# else
1779#  if !1
1780_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
1781                                 _GL_ATTRIBUTE_PURE);
1782#  endif
1783_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1784# endif
1785# if __GLIBC__ >= 2
1786_GL_CXXALIASWARN (wcswidth);
1787# endif
1788#elif defined GNULIB_POSIXCHECK
1789# undef wcswidth
1790# if HAVE_RAW_DECL_WCSWIDTH
1791_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1792                 "use gnulib module wcswidth for portability");
1793# endif
1794#endif
1795
1796
1797/* Convert *TP to a date and time wide string.  See
1798   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>.  */
1799#if 0
1800# if 0
1801#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1802#   undef wcsftime
1803#   define wcsftime rpl_wcsftime
1804#  endif
1805_GL_FUNCDECL_RPL (wcsftime, size_t,
1806                  (wchar_t *restrict __buf, size_t __bufsize,
1807                   const wchar_t *restrict __fmt,
1808                   const struct tm *restrict __tp)
1809                  _GL_ARG_NONNULL ((1, 3, 4)));
1810_GL_CXXALIAS_RPL (wcsftime, size_t,
1811                  (wchar_t *restrict __buf, size_t __bufsize,
1812                   const wchar_t *restrict __fmt,
1813                   const struct tm *restrict __tp));
1814# else
1815#  if !1
1816_GL_FUNCDECL_SYS (wcsftime, size_t,
1817                  (wchar_t *restrict __buf, size_t __bufsize,
1818                   const wchar_t *restrict __fmt,
1819                   const struct tm *restrict __tp)
1820                  _GL_ARG_NONNULL ((1, 3, 4)));
1821#  endif
1822_GL_CXXALIAS_SYS (wcsftime, size_t,
1823                  (wchar_t *restrict __buf, size_t __bufsize,
1824                   const wchar_t *restrict __fmt,
1825                   const struct tm *restrict __tp));
1826# endif
1827# if __GLIBC__ >= 2
1828_GL_CXXALIASWARN (wcsftime);
1829# endif
1830#elif defined GNULIB_POSIXCHECK
1831# undef wcsftime
1832# if HAVE_RAW_DECL_WCSFTIME
1833_GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
1834                 "use gnulib module wcsftime for portability");
1835# endif
1836#endif
1837
1838
1839#endif /* _GL_WCHAR_H */
1840#endif /* _GL_WCHAR_H */
1841#endif
1842