1 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
2 
3    Copyright (C) 2007-2020 Free Software Foundation, Inc.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3, or (at your option)
8    any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, see <https://www.gnu.org/licenses/>.  */
17 
18 /* Written by Eric Blake.  */
19 
20 /*
21  * ISO C 99 <wchar.h> for platforms that have issues.
22  * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html>
23  *
24  * For now, this just ensures proper prerequisite inclusion order and
25  * the declaration of wcwidth().
26  */
27 
28 #if __GNUC__ >= 3
29 @PRAGMA_SYSTEM_HEADER@
30 #endif
31 @PRAGMA_COLUMNS@
32 
33 #if (((defined __need_mbstate_t || defined __need_wint_t)               \
34       && !defined __MINGW32__)                                          \
35      || (defined __hpux                                                 \
36          && ((defined _INTTYPES_INCLUDED                                \
37               && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H)     \
38              || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
39      || (defined __MINGW32__ && defined __STRING_H_SOURCED__)           \
40      || defined _GL_ALREADY_INCLUDING_WCHAR_H)
41 /* Special invocation convention:
42    - Inside glibc and uClibc header files, but not MinGW.
43    - On HP-UX 11.00 we have a sequence of nested includes
44      <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
45      once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
46      and once directly.  In both situations 'wint_t' is not yet defined,
47      therefore we cannot provide the function overrides; instead include only
48      the system's <wchar.h>.
49    - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of
50      <wchar.h> is actually processed, and that doesn't include 'mbstate_t'.
51    - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
52      the latter includes <wchar.h>.  But here, we have no way to detect whether
53      <wctype.h> is completely included or is still being included.  */
54 
55 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
56 
57 #else
58 /* Normal invocation convention.  */
59 
60 #ifndef _@GUARD_PREFIX@_WCHAR_H
61 
62 #define _GL_ALREADY_INCLUDING_WCHAR_H
63 
64 #if @HAVE_FEATURES_H@
65 # include <features.h> /* for __GLIBC__ */
66 #endif
67 
68 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
69    <wchar.h>.
70    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
71    included before <wchar.h>.
72    In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
73    by <stddef.h>.
74    But avoid namespace pollution on glibc systems.  */
75 #if !(defined __GLIBC__ && !defined __UCLIBC__)
76 # include <stddef.h>
77 #endif
78 #ifndef __GLIBC__
79 # include <stdio.h>
80 # include <time.h>
81 #endif
82 
83 /* Include the original <wchar.h> if it exists.
84    Some builds of uClibc lack it.  */
85 /* The include_next requires a split double-inclusion guard.  */
86 #if @HAVE_WCHAR_H@
87 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
88 #endif
89 
90 #undef _GL_ALREADY_INCLUDING_WCHAR_H
91 
92 #ifndef _@GUARD_PREFIX@_WCHAR_H
93 #define _@GUARD_PREFIX@_WCHAR_H
94 
95 /* The __attribute__ feature is available in gcc versions 2.5 and later.
96    The attribute __pure__ was added in gcc 2.96.  */
97 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
98 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
99 #else
100 # define _GL_ATTRIBUTE_PURE /* empty */
101 #endif
102 
103 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
104 
105 /* The definition of _GL_ARG_NONNULL is copied here.  */
106 
107 /* The definition of _GL_WARN_ON_USE is copied here.  */
108 
109 
110 /* Define wint_t and WEOF.  (Also done in wctype.in.h.)  */
111 #if !@HAVE_WINT_T@ && !defined wint_t
112 # define wint_t int
113 # ifndef WEOF
114 #  define WEOF -1
115 # endif
116 #else
117 /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
118    <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
119    wint_t must be "unchanged by default argument promotions".  Override it.  */
120 # if @GNULIB_OVERRIDES_WINT_T@
121 #  if !GNULIB_defined_wint_t
122 #   if @HAVE_CRTDEFS_H@
123 #    include <crtdefs.h>
124 #   else
125 #    include <stddef.h>
126 #   endif
127 typedef unsigned int rpl_wint_t;
128 #   undef wint_t
129 #   define wint_t rpl_wint_t
130 #   define GNULIB_defined_wint_t 1
131 #  endif
132 # endif
133 # ifndef WEOF
134 #  define WEOF ((wint_t) -1)
135 # endif
136 #endif
137 
138 
139 /* Override mbstate_t if it is too small.
140    On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
141    implementing mbrtowc for encodings like UTF-8.
142    On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is
143    large enough and overriding it would cause problems in C++ mode.  */
144 #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
145 # if !GNULIB_defined_mbstate_t
146 #  if !(defined _AIX || defined _MSC_VER)
147 typedef int rpl_mbstate_t;
148 #   undef mbstate_t
149 #   define mbstate_t rpl_mbstate_t
150 #  endif
151 #  define GNULIB_defined_mbstate_t 1
152 # endif
153 #endif
154 
155 
156 /* Convert a single-byte character to a wide character.  */
157 #if @GNULIB_BTOWC@
158 # if @REPLACE_BTOWC@
159 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
160 #   undef btowc
161 #   define btowc rpl_btowc
162 #  endif
163 _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
164 _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
165 # else
166 #  if !@HAVE_BTOWC@
167 _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
168 #  endif
169 /* Need to cast, because on mingw, the return type is 'unsigned short'.  */
170 _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
171 # endif
172 # if __GLIBC__ >= 2
173 _GL_CXXALIASWARN (btowc);
174 # endif
175 #elif defined GNULIB_POSIXCHECK
176 # undef btowc
177 # if HAVE_RAW_DECL_BTOWC
178 _GL_WARN_ON_USE (btowc, "btowc is unportable - "
179                  "use gnulib module btowc for portability");
180 # endif
181 #endif
182 
183 
184 /* Convert a wide character to a single-byte character.  */
185 #if @GNULIB_WCTOB@
186 # if @REPLACE_WCTOB@
187 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
188 #   undef wctob
189 #   define wctob rpl_wctob
190 #  endif
191 _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
192 _GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
193 # else
194 #  if !defined wctob && !@HAVE_DECL_WCTOB@
195 /* wctob is provided by gnulib, or wctob exists but is not declared.  */
196 _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
197 #  endif
198 _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
199 # endif
200 # if __GLIBC__ >= 2
201 _GL_CXXALIASWARN (wctob);
202 # endif
203 #elif defined GNULIB_POSIXCHECK
204 # undef wctob
205 # if HAVE_RAW_DECL_WCTOB
206 _GL_WARN_ON_USE (wctob, "wctob is unportable - "
207                  "use gnulib module wctob for portability");
208 # endif
209 #endif
210 
211 
212 /* Test whether *PS is in the initial state.  */
213 #if @GNULIB_MBSINIT@
214 # if @REPLACE_MBSINIT@
215 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
216 #   undef mbsinit
217 #   define mbsinit rpl_mbsinit
218 #  endif
219 _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
220 _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
221 # else
222 #  if !@HAVE_MBSINIT@
223 _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
224 #  endif
225 _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
226 # endif
227 # if __GLIBC__ >= 2
228 _GL_CXXALIASWARN (mbsinit);
229 # endif
230 #elif defined GNULIB_POSIXCHECK
231 # undef mbsinit
232 # if HAVE_RAW_DECL_MBSINIT
233 _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
234                  "use gnulib module mbsinit for portability");
235 # endif
236 #endif
237 
238 
239 /* Convert a multibyte character to a wide character.  */
240 #if @GNULIB_MBRTOWC@
241 # if @REPLACE_MBRTOWC@
242 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
243 #   undef mbrtowc
244 #   define mbrtowc rpl_mbrtowc
245 #  endif
246 _GL_FUNCDECL_RPL (mbrtowc, size_t,
247                   (wchar_t *restrict pwc, const char *restrict s, size_t n,
248                    mbstate_t *restrict ps));
249 _GL_CXXALIAS_RPL (mbrtowc, size_t,
250                   (wchar_t *restrict pwc, const char *restrict s, size_t n,
251                    mbstate_t *restrict ps));
252 # else
253 #  if !@HAVE_MBRTOWC@
254 _GL_FUNCDECL_SYS (mbrtowc, size_t,
255                   (wchar_t *restrict pwc, const char *restrict s, size_t n,
256                    mbstate_t *restrict ps));
257 #  endif
258 _GL_CXXALIAS_SYS (mbrtowc, size_t,
259                   (wchar_t *restrict pwc, const char *restrict s, size_t n,
260                    mbstate_t *restrict ps));
261 # endif
262 # if __GLIBC__ >= 2
263 _GL_CXXALIASWARN (mbrtowc);
264 # endif
265 #elif defined GNULIB_POSIXCHECK
266 # undef mbrtowc
267 # if HAVE_RAW_DECL_MBRTOWC
268 _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
269                  "use gnulib module mbrtowc for portability");
270 # endif
271 #endif
272 
273 
274 /* Recognize a multibyte character.  */
275 #if @GNULIB_MBRLEN@
276 # if @REPLACE_MBRLEN@
277 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
278 #   undef mbrlen
279 #   define mbrlen rpl_mbrlen
280 #  endif
281 _GL_FUNCDECL_RPL (mbrlen, size_t,
282                   (const char *restrict s, size_t n, mbstate_t *restrict ps));
283 _GL_CXXALIAS_RPL (mbrlen, size_t,
284                   (const char *restrict s, size_t n, mbstate_t *restrict ps));
285 # else
286 #  if !@HAVE_MBRLEN@
287 _GL_FUNCDECL_SYS (mbrlen, size_t,
288                   (const char *restrict s, size_t n, mbstate_t *restrict ps));
289 #  endif
290 _GL_CXXALIAS_SYS (mbrlen, size_t,
291                   (const char *restrict s, size_t n, mbstate_t *restrict ps));
292 # endif
293 # if __GLIBC__ >= 2
294 _GL_CXXALIASWARN (mbrlen);
295 # endif
296 #elif defined GNULIB_POSIXCHECK
297 # undef mbrlen
298 # if HAVE_RAW_DECL_MBRLEN
299 _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
300                  "use gnulib module mbrlen for portability");
301 # endif
302 #endif
303 
304 
305 /* Convert a string to a wide string.  */
306 #if @GNULIB_MBSRTOWCS@
307 # if @REPLACE_MBSRTOWCS@
308 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
309 #   undef mbsrtowcs
310 #   define mbsrtowcs rpl_mbsrtowcs
311 #  endif
312 _GL_FUNCDECL_RPL (mbsrtowcs, size_t,
313                   (wchar_t *restrict dest,
314                    const char **restrict srcp, size_t len,
315                    mbstate_t *restrict ps)
316                   _GL_ARG_NONNULL ((2)));
317 _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
318                   (wchar_t *restrict dest,
319                    const char **restrict srcp, size_t len,
320                    mbstate_t *restrict ps));
321 # else
322 #  if !@HAVE_MBSRTOWCS@
323 _GL_FUNCDECL_SYS (mbsrtowcs, size_t,
324                   (wchar_t *restrict dest,
325                    const char **restrict srcp, size_t len,
326                    mbstate_t *restrict ps)
327                   _GL_ARG_NONNULL ((2)));
328 #  endif
329 _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
330                   (wchar_t *restrict dest,
331                    const char **restrict srcp, size_t len,
332                    mbstate_t *restrict ps));
333 # endif
334 # if __GLIBC__ >= 2
335 _GL_CXXALIASWARN (mbsrtowcs);
336 # endif
337 #elif defined GNULIB_POSIXCHECK
338 # undef mbsrtowcs
339 # if HAVE_RAW_DECL_MBSRTOWCS
340 _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
341                  "use gnulib module mbsrtowcs for portability");
342 # endif
343 #endif
344 
345 
346 /* Convert a string to a wide string.  */
347 #if @GNULIB_MBSNRTOWCS@
348 # if @REPLACE_MBSNRTOWCS@
349 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
350 #   undef mbsnrtowcs
351 #   define mbsnrtowcs rpl_mbsnrtowcs
352 #  endif
353 _GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
354                   (wchar_t *restrict dest,
355                    const char **restrict srcp, size_t srclen, size_t len,
356                    mbstate_t *restrict ps)
357                   _GL_ARG_NONNULL ((2)));
358 _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
359                   (wchar_t *restrict dest,
360                    const char **restrict srcp, size_t srclen, size_t len,
361                    mbstate_t *restrict ps));
362 # else
363 #  if !@HAVE_MBSNRTOWCS@
364 _GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
365                   (wchar_t *restrict dest,
366                    const char **restrict srcp, size_t srclen, size_t len,
367                    mbstate_t *restrict ps)
368                   _GL_ARG_NONNULL ((2)));
369 #  endif
370 _GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
371                   (wchar_t *restrict dest,
372                    const char **restrict srcp, size_t srclen, size_t len,
373                    mbstate_t *restrict ps));
374 # endif
375 _GL_CXXALIASWARN (mbsnrtowcs);
376 #elif defined GNULIB_POSIXCHECK
377 # undef mbsnrtowcs
378 # if HAVE_RAW_DECL_MBSNRTOWCS
379 _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
380                  "use gnulib module mbsnrtowcs for portability");
381 # endif
382 #endif
383 
384 
385 /* Convert a wide character to a multibyte character.  */
386 #if @GNULIB_WCRTOMB@
387 # if @REPLACE_WCRTOMB@
388 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
389 #   undef wcrtomb
390 #   define wcrtomb rpl_wcrtomb
391 #  endif
392 _GL_FUNCDECL_RPL (wcrtomb, size_t,
393                   (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
394 _GL_CXXALIAS_RPL (wcrtomb, size_t,
395                   (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
396 # else
397 #  if !@HAVE_WCRTOMB@
398 _GL_FUNCDECL_SYS (wcrtomb, size_t,
399                   (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
400 #  endif
401 _GL_CXXALIAS_SYS (wcrtomb, size_t,
402                   (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
403 # endif
404 # if __GLIBC__ >= 2
405 _GL_CXXALIASWARN (wcrtomb);
406 # endif
407 #elif defined GNULIB_POSIXCHECK
408 # undef wcrtomb
409 # if HAVE_RAW_DECL_WCRTOMB
410 _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
411                  "use gnulib module wcrtomb for portability");
412 # endif
413 #endif
414 
415 
416 /* Convert a wide string to a string.  */
417 #if @GNULIB_WCSRTOMBS@
418 # if @REPLACE_WCSRTOMBS@
419 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
420 #   undef wcsrtombs
421 #   define wcsrtombs rpl_wcsrtombs
422 #  endif
423 _GL_FUNCDECL_RPL (wcsrtombs, size_t,
424                   (char *restrict dest, const wchar_t **restrict srcp,
425                    size_t len,
426                    mbstate_t *restrict ps)
427                   _GL_ARG_NONNULL ((2)));
428 _GL_CXXALIAS_RPL (wcsrtombs, size_t,
429                   (char *restrict dest, const wchar_t **restrict srcp,
430                    size_t len,
431                    mbstate_t *restrict ps));
432 # else
433 #  if !@HAVE_WCSRTOMBS@
434 _GL_FUNCDECL_SYS (wcsrtombs, size_t,
435                   (char *restrict dest, const wchar_t **restrict srcp,
436                    size_t len,
437                    mbstate_t *restrict ps)
438                   _GL_ARG_NONNULL ((2)));
439 #  endif
440 _GL_CXXALIAS_SYS (wcsrtombs, size_t,
441                   (char *restrict dest, const wchar_t **restrict srcp,
442                    size_t len,
443                    mbstate_t *restrict ps));
444 # endif
445 # if __GLIBC__ >= 2
446 _GL_CXXALIASWARN (wcsrtombs);
447 # endif
448 #elif defined GNULIB_POSIXCHECK
449 # undef wcsrtombs
450 # if HAVE_RAW_DECL_WCSRTOMBS
451 _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
452                  "use gnulib module wcsrtombs for portability");
453 # endif
454 #endif
455 
456 
457 /* Convert a wide string to a string.  */
458 #if @GNULIB_WCSNRTOMBS@
459 # if @REPLACE_WCSNRTOMBS@
460 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
461 #   undef wcsnrtombs
462 #   define wcsnrtombs rpl_wcsnrtombs
463 #  endif
464 _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
465                   (char *restrict dest,
466                    const wchar_t **restrict srcp, size_t srclen,
467                    size_t len,
468                    mbstate_t *restrict ps)
469                   _GL_ARG_NONNULL ((2)));
470 _GL_CXXALIAS_RPL (wcsnrtombs, size_t,
471                   (char *restrict dest,
472                    const wchar_t **restrict srcp, size_t srclen,
473                    size_t len,
474                    mbstate_t *restrict ps));
475 # else
476 #  if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
477 _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
478                   (char *restrict dest,
479                    const wchar_t **restrict srcp, size_t srclen,
480                    size_t len,
481                    mbstate_t *restrict ps)
482                   _GL_ARG_NONNULL ((2)));
483 #  endif
484 _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
485                   (char *restrict dest,
486                    const wchar_t **restrict srcp, size_t srclen,
487                    size_t len,
488                    mbstate_t *restrict ps));
489 # endif
490 # if __GLIBC__ >= 2
491 _GL_CXXALIASWARN (wcsnrtombs);
492 # endif
493 #elif defined GNULIB_POSIXCHECK
494 # undef wcsnrtombs
495 # if HAVE_RAW_DECL_WCSNRTOMBS
496 _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
497                  "use gnulib module wcsnrtombs for portability");
498 # endif
499 #endif
500 
501 
502 /* Return the number of screen columns needed for WC.  */
503 #if @GNULIB_WCWIDTH@
504 # if @REPLACE_WCWIDTH@
505 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
506 #   undef wcwidth
507 #   define wcwidth rpl_wcwidth
508 #  endif
509 _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
510 _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
511 # else
512 #  if !@HAVE_DECL_WCWIDTH@
513 /* wcwidth exists but is not declared.  */
514 _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
515 #  endif
516 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
517 # endif
518 # if __GLIBC__ >= 2
519 _GL_CXXALIASWARN (wcwidth);
520 # endif
521 #elif defined GNULIB_POSIXCHECK
522 # undef wcwidth
523 # if HAVE_RAW_DECL_WCWIDTH
524 _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
525                  "use gnulib module wcwidth for portability");
526 # endif
527 #endif
528 
529 
530 /* Search N wide characters of S for C.  */
531 #if @GNULIB_WMEMCHR@
532 # if !@HAVE_WMEMCHR@
533 _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
534                                       _GL_ATTRIBUTE_PURE);
535 # endif
536   /* On some systems, this function is defined as an overloaded function:
537        extern "C++" {
538          const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
539          wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
540        }  */
541 _GL_CXXALIAS_SYS_CAST2 (wmemchr,
542                         wchar_t *, (const wchar_t *, wchar_t, size_t),
543                         const wchar_t *, (const wchar_t *, wchar_t, size_t));
544 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
545      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
546 _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
547 _GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
548                    (const wchar_t *s, wchar_t c, size_t n));
549 # elif __GLIBC__ >= 2
550 _GL_CXXALIASWARN (wmemchr);
551 # endif
552 #elif defined GNULIB_POSIXCHECK
553 # undef wmemchr
554 # if HAVE_RAW_DECL_WMEMCHR
555 _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
556                  "use gnulib module wmemchr for portability");
557 # endif
558 #endif
559 
560 
561 /* Compare N wide characters of S1 and S2.  */
562 #if @GNULIB_WMEMCMP@
563 # if !@HAVE_WMEMCMP@
564 _GL_FUNCDECL_SYS (wmemcmp, int,
565                   (const wchar_t *s1, const wchar_t *s2, size_t n)
566                   _GL_ATTRIBUTE_PURE);
567 # endif
568 _GL_CXXALIAS_SYS (wmemcmp, int,
569                   (const wchar_t *s1, const wchar_t *s2, size_t n));
570 # if __GLIBC__ >= 2
571 _GL_CXXALIASWARN (wmemcmp);
572 # endif
573 #elif defined GNULIB_POSIXCHECK
574 # undef wmemcmp
575 # if HAVE_RAW_DECL_WMEMCMP
576 _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
577                  "use gnulib module wmemcmp for portability");
578 # endif
579 #endif
580 
581 
582 /* Copy N wide characters of SRC to DEST.  */
583 #if @GNULIB_WMEMCPY@
584 # if !@HAVE_WMEMCPY@
585 _GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
586                   (wchar_t *restrict dest,
587                    const wchar_t *restrict src, size_t n));
588 # endif
589 _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
590                   (wchar_t *restrict dest,
591                    const wchar_t *restrict src, size_t n));
592 # if __GLIBC__ >= 2
593 _GL_CXXALIASWARN (wmemcpy);
594 # endif
595 #elif defined GNULIB_POSIXCHECK
596 # undef wmemcpy
597 # if HAVE_RAW_DECL_WMEMCPY
598 _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
599                  "use gnulib module wmemcpy for portability");
600 # endif
601 #endif
602 
603 
604 /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
605    overlapping memory areas.  */
606 #if @GNULIB_WMEMMOVE@
607 # if !@HAVE_WMEMMOVE@
608 _GL_FUNCDECL_SYS (wmemmove, wchar_t *,
609                   (wchar_t *dest, const wchar_t *src, size_t n));
610 # endif
611 _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
612                   (wchar_t *dest, const wchar_t *src, size_t n));
613 # if __GLIBC__ >= 2
614 _GL_CXXALIASWARN (wmemmove);
615 # endif
616 #elif defined GNULIB_POSIXCHECK
617 # undef wmemmove
618 # if HAVE_RAW_DECL_WMEMMOVE
619 _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
620                  "use gnulib module wmemmove for portability");
621 # endif
622 #endif
623 
624 
625 /* Set N wide characters of S to C.  */
626 #if @GNULIB_WMEMSET@
627 # if !@HAVE_WMEMSET@
628 _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
629 # endif
630 _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
631 # if __GLIBC__ >= 2
632 _GL_CXXALIASWARN (wmemset);
633 # endif
634 #elif defined GNULIB_POSIXCHECK
635 # undef wmemset
636 # if HAVE_RAW_DECL_WMEMSET
637 _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
638                  "use gnulib module wmemset for portability");
639 # endif
640 #endif
641 
642 
643 /* Return the number of wide characters in S.  */
644 #if @GNULIB_WCSLEN@
645 # if !@HAVE_WCSLEN@
646 _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
647 # endif
648 _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
649 # if __GLIBC__ >= 2
650 _GL_CXXALIASWARN (wcslen);
651 # endif
652 #elif defined GNULIB_POSIXCHECK
653 # undef wcslen
654 # if HAVE_RAW_DECL_WCSLEN
655 _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
656                  "use gnulib module wcslen for portability");
657 # endif
658 #endif
659 
660 
661 /* Return the number of wide characters in S, but at most MAXLEN.  */
662 #if @GNULIB_WCSNLEN@
663 # if !@HAVE_WCSNLEN@
664 _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
665                                    _GL_ATTRIBUTE_PURE);
666 # endif
667 _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
668 _GL_CXXALIASWARN (wcsnlen);
669 #elif defined GNULIB_POSIXCHECK
670 # undef wcsnlen
671 # if HAVE_RAW_DECL_WCSNLEN
672 _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
673                  "use gnulib module wcsnlen for portability");
674 # endif
675 #endif
676 
677 
678 /* Copy SRC to DEST.  */
679 #if @GNULIB_WCSCPY@
680 # if !@HAVE_WCSCPY@
681 _GL_FUNCDECL_SYS (wcscpy, wchar_t *,
682                   (wchar_t *restrict dest, const wchar_t *restrict src));
683 # endif
684 _GL_CXXALIAS_SYS (wcscpy, wchar_t *,
685                   (wchar_t *restrict dest, const wchar_t *restrict src));
686 # if __GLIBC__ >= 2
687 _GL_CXXALIASWARN (wcscpy);
688 # endif
689 #elif defined GNULIB_POSIXCHECK
690 # undef wcscpy
691 # if HAVE_RAW_DECL_WCSCPY
692 _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
693                  "use gnulib module wcscpy for portability");
694 # endif
695 #endif
696 
697 
698 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST.  */
699 #if @GNULIB_WCPCPY@
700 # if !@HAVE_WCPCPY@
701 _GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
702                   (wchar_t *restrict dest, const wchar_t *restrict src));
703 # endif
704 _GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
705                   (wchar_t *restrict dest, const wchar_t *restrict src));
706 _GL_CXXALIASWARN (wcpcpy);
707 #elif defined GNULIB_POSIXCHECK
708 # undef wcpcpy
709 # if HAVE_RAW_DECL_WCPCPY
710 _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
711                  "use gnulib module wcpcpy for portability");
712 # endif
713 #endif
714 
715 
716 /* Copy no more than N wide characters of SRC to DEST.  */
717 #if @GNULIB_WCSNCPY@
718 # if !@HAVE_WCSNCPY@
719 _GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
720                   (wchar_t *restrict dest,
721                    const wchar_t *restrict src, size_t n));
722 # endif
723 _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
724                   (wchar_t *restrict dest,
725                    const wchar_t *restrict src, size_t n));
726 # if __GLIBC__ >= 2
727 _GL_CXXALIASWARN (wcsncpy);
728 # endif
729 #elif defined GNULIB_POSIXCHECK
730 # undef wcsncpy
731 # if HAVE_RAW_DECL_WCSNCPY
732 _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
733                  "use gnulib module wcsncpy for portability");
734 # endif
735 #endif
736 
737 
738 /* Copy no more than N characters of SRC to DEST, returning the address of
739    the last character written into DEST.  */
740 #if @GNULIB_WCPNCPY@
741 # if !@HAVE_WCPNCPY@
742 _GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
743                   (wchar_t *restrict dest,
744                    const wchar_t *restrict src, size_t n));
745 # endif
746 _GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
747                   (wchar_t *restrict dest,
748                    const wchar_t *restrict src, size_t n));
749 _GL_CXXALIASWARN (wcpncpy);
750 #elif defined GNULIB_POSIXCHECK
751 # undef wcpncpy
752 # if HAVE_RAW_DECL_WCPNCPY
753 _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
754                  "use gnulib module wcpncpy for portability");
755 # endif
756 #endif
757 
758 
759 /* Append SRC onto DEST.  */
760 #if @GNULIB_WCSCAT@
761 # if !@HAVE_WCSCAT@
762 _GL_FUNCDECL_SYS (wcscat, wchar_t *,
763                   (wchar_t *restrict dest, const wchar_t *restrict src));
764 # endif
765 _GL_CXXALIAS_SYS (wcscat, wchar_t *,
766                   (wchar_t *restrict dest, const wchar_t *restrict src));
767 # if __GLIBC__ >= 2
768 _GL_CXXALIASWARN (wcscat);
769 # endif
770 #elif defined GNULIB_POSIXCHECK
771 # undef wcscat
772 # if HAVE_RAW_DECL_WCSCAT
773 _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
774                  "use gnulib module wcscat for portability");
775 # endif
776 #endif
777 
778 
779 /* Append no more than N wide characters of SRC onto DEST.  */
780 #if @GNULIB_WCSNCAT@
781 # if !@HAVE_WCSNCAT@
782 _GL_FUNCDECL_SYS (wcsncat, wchar_t *,
783                   (wchar_t *restrict dest, const wchar_t *restrict src,
784                    size_t n));
785 # endif
786 _GL_CXXALIAS_SYS (wcsncat, wchar_t *,
787                   (wchar_t *restrict dest, const wchar_t *restrict src,
788                    size_t n));
789 # if __GLIBC__ >= 2
790 _GL_CXXALIASWARN (wcsncat);
791 # endif
792 #elif defined GNULIB_POSIXCHECK
793 # undef wcsncat
794 # if HAVE_RAW_DECL_WCSNCAT
795 _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
796                  "use gnulib module wcsncat for portability");
797 # endif
798 #endif
799 
800 
801 /* Compare S1 and S2.  */
802 #if @GNULIB_WCSCMP@
803 # if !@HAVE_WCSCMP@
804 _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
805                                _GL_ATTRIBUTE_PURE);
806 # endif
807 _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
808 # if __GLIBC__ >= 2
809 _GL_CXXALIASWARN (wcscmp);
810 # endif
811 #elif defined GNULIB_POSIXCHECK
812 # undef wcscmp
813 # if HAVE_RAW_DECL_WCSCMP
814 _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
815                  "use gnulib module wcscmp for portability");
816 # endif
817 #endif
818 
819 
820 /* Compare no more than N wide characters of S1 and S2.  */
821 #if @GNULIB_WCSNCMP@
822 # if !@HAVE_WCSNCMP@
823 _GL_FUNCDECL_SYS (wcsncmp, int,
824                   (const wchar_t *s1, const wchar_t *s2, size_t n)
825                   _GL_ATTRIBUTE_PURE);
826 # endif
827 _GL_CXXALIAS_SYS (wcsncmp, int,
828                   (const wchar_t *s1, const wchar_t *s2, size_t n));
829 # if __GLIBC__ >= 2
830 _GL_CXXALIASWARN (wcsncmp);
831 # endif
832 #elif defined GNULIB_POSIXCHECK
833 # undef wcsncmp
834 # if HAVE_RAW_DECL_WCSNCMP
835 _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
836                  "use gnulib module wcsncmp for portability");
837 # endif
838 #endif
839 
840 
841 /* Compare S1 and S2, ignoring case.  */
842 #if @GNULIB_WCSCASECMP@
843 # if !@HAVE_WCSCASECMP@
844 _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
845                                    _GL_ATTRIBUTE_PURE);
846 # endif
847 _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
848 _GL_CXXALIASWARN (wcscasecmp);
849 #elif defined GNULIB_POSIXCHECK
850 # undef wcscasecmp
851 # if HAVE_RAW_DECL_WCSCASECMP
852 _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
853                  "use gnulib module wcscasecmp for portability");
854 # endif
855 #endif
856 
857 
858 /* Compare no more than N chars of S1 and S2, ignoring case.  */
859 #if @GNULIB_WCSNCASECMP@
860 # if !@HAVE_WCSNCASECMP@
861 _GL_FUNCDECL_SYS (wcsncasecmp, int,
862                   (const wchar_t *s1, const wchar_t *s2, size_t n)
863                   _GL_ATTRIBUTE_PURE);
864 # endif
865 _GL_CXXALIAS_SYS (wcsncasecmp, int,
866                   (const wchar_t *s1, const wchar_t *s2, size_t n));
867 _GL_CXXALIASWARN (wcsncasecmp);
868 #elif defined GNULIB_POSIXCHECK
869 # undef wcsncasecmp
870 # if HAVE_RAW_DECL_WCSNCASECMP
871 _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
872                  "use gnulib module wcsncasecmp for portability");
873 # endif
874 #endif
875 
876 
877 /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
878    category of the current locale.  */
879 #if @GNULIB_WCSCOLL@
880 # if !@HAVE_WCSCOLL@
881 _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
882 # endif
883 _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
884 # if __GLIBC__ >= 2
885 _GL_CXXALIASWARN (wcscoll);
886 # endif
887 #elif defined GNULIB_POSIXCHECK
888 # undef wcscoll
889 # if HAVE_RAW_DECL_WCSCOLL
890 _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
891                  "use gnulib module wcscoll for portability");
892 # endif
893 #endif
894 
895 
896 /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
897    to two transformed strings the result is the as applying 'wcscoll' to the
898    original strings.  */
899 #if @GNULIB_WCSXFRM@
900 # if !@HAVE_WCSXFRM@
901 _GL_FUNCDECL_SYS (wcsxfrm, size_t,
902                   (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
903 # endif
904 _GL_CXXALIAS_SYS (wcsxfrm, size_t,
905                   (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
906 # if __GLIBC__ >= 2
907 _GL_CXXALIASWARN (wcsxfrm);
908 # endif
909 #elif defined GNULIB_POSIXCHECK
910 # undef wcsxfrm
911 # if HAVE_RAW_DECL_WCSXFRM
912 _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
913                  "use gnulib module wcsxfrm for portability");
914 # endif
915 #endif
916 
917 
918 /* Duplicate S, returning an identical malloc'd string.  */
919 #if @GNULIB_WCSDUP@
920 # if !@HAVE_WCSDUP@
921 _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
922 # endif
923 _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
924 _GL_CXXALIASWARN (wcsdup);
925 #elif defined GNULIB_POSIXCHECK
926 # undef wcsdup
927 # if HAVE_RAW_DECL_WCSDUP
928 _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
929                  "use gnulib module wcsdup for portability");
930 # endif
931 #endif
932 
933 
934 /* Find the first occurrence of WC in WCS.  */
935 #if @GNULIB_WCSCHR@
936 # if !@HAVE_WCSCHR@
937 _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
938                                      _GL_ATTRIBUTE_PURE);
939 # endif
940   /* On some systems, this function is defined as an overloaded function:
941        extern "C++" {
942          const wchar_t * std::wcschr (const wchar_t *, wchar_t);
943          wchar_t * std::wcschr (wchar_t *, wchar_t);
944        }  */
945 _GL_CXXALIAS_SYS_CAST2 (wcschr,
946                         wchar_t *, (const wchar_t *, wchar_t),
947                         const wchar_t *, (const wchar_t *, wchar_t));
948 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
949      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
950 _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
951 _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
952 # elif __GLIBC__ >= 2
953 _GL_CXXALIASWARN (wcschr);
954 # endif
955 #elif defined GNULIB_POSIXCHECK
956 # undef wcschr
957 # if HAVE_RAW_DECL_WCSCHR
958 _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
959                  "use gnulib module wcschr for portability");
960 # endif
961 #endif
962 
963 
964 /* Find the last occurrence of WC in WCS.  */
965 #if @GNULIB_WCSRCHR@
966 # if !@HAVE_WCSRCHR@
967 _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
968                                       _GL_ATTRIBUTE_PURE);
969 # endif
970   /* On some systems, this function is defined as an overloaded function:
971        extern "C++" {
972          const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
973          wchar_t * std::wcsrchr (wchar_t *, wchar_t);
974        }  */
975 _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
976                         wchar_t *, (const wchar_t *, wchar_t),
977                         const wchar_t *, (const wchar_t *, wchar_t));
978 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
979      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
980 _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
981 _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
982 # elif __GLIBC__ >= 2
983 _GL_CXXALIASWARN (wcsrchr);
984 # endif
985 #elif defined GNULIB_POSIXCHECK
986 # undef wcsrchr
987 # if HAVE_RAW_DECL_WCSRCHR
988 _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
989                  "use gnulib module wcsrchr for portability");
990 # endif
991 #endif
992 
993 
994 /* Return the length of the initial segmet of WCS which consists entirely
995    of wide characters not in REJECT.  */
996 #if @GNULIB_WCSCSPN@
997 # if !@HAVE_WCSCSPN@
998 _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
999                                    _GL_ATTRIBUTE_PURE);
1000 # endif
1001 _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
1002 # if __GLIBC__ >= 2
1003 _GL_CXXALIASWARN (wcscspn);
1004 # endif
1005 #elif defined GNULIB_POSIXCHECK
1006 # undef wcscspn
1007 # if HAVE_RAW_DECL_WCSCSPN
1008 _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
1009                  "use gnulib module wcscspn for portability");
1010 # endif
1011 #endif
1012 
1013 
1014 /* Return the length of the initial segmet of WCS which consists entirely
1015    of wide characters in ACCEPT.  */
1016 #if @GNULIB_WCSSPN@
1017 # if !@HAVE_WCSSPN@
1018 _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
1019                                   _GL_ATTRIBUTE_PURE);
1020 # endif
1021 _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
1022 # if __GLIBC__ >= 2
1023 _GL_CXXALIASWARN (wcsspn);
1024 # endif
1025 #elif defined GNULIB_POSIXCHECK
1026 # undef wcsspn
1027 # if HAVE_RAW_DECL_WCSSPN
1028 _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
1029                  "use gnulib module wcsspn for portability");
1030 # endif
1031 #endif
1032 
1033 
1034 /* Find the first occurrence in WCS of any character in ACCEPT.  */
1035 #if @GNULIB_WCSPBRK@
1036 # if !@HAVE_WCSPBRK@
1037 _GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
1038                   (const wchar_t *wcs, const wchar_t *accept)
1039                   _GL_ATTRIBUTE_PURE);
1040 # endif
1041   /* On some systems, this function is defined as an overloaded function:
1042        extern "C++" {
1043          const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
1044          wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
1045        }  */
1046 _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
1047                         wchar_t *, (const wchar_t *, const wchar_t *),
1048                         const wchar_t *, (const wchar_t *, const wchar_t *));
1049 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1050      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1051 _GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
1052                    (wchar_t *wcs, const wchar_t *accept));
1053 _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
1054                    (const wchar_t *wcs, const wchar_t *accept));
1055 # elif __GLIBC__ >= 2
1056 _GL_CXXALIASWARN (wcspbrk);
1057 # endif
1058 #elif defined GNULIB_POSIXCHECK
1059 # undef wcspbrk
1060 # if HAVE_RAW_DECL_WCSPBRK
1061 _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
1062                  "use gnulib module wcspbrk for portability");
1063 # endif
1064 #endif
1065 
1066 
1067 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
1068 #if @GNULIB_WCSSTR@
1069 # if !@HAVE_WCSSTR@
1070 _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
1071                   (const wchar_t *restrict haystack,
1072                    const wchar_t *restrict needle)
1073                   _GL_ATTRIBUTE_PURE);
1074 # endif
1075   /* On some systems, this function is defined as an overloaded function:
1076        extern "C++" {
1077          const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
1078          wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
1079        }  */
1080 _GL_CXXALIAS_SYS_CAST2 (wcsstr,
1081                         wchar_t *,
1082                         (const wchar_t *restrict, const wchar_t *restrict),
1083                         const wchar_t *,
1084                         (const wchar_t *restrict, const wchar_t *restrict));
1085 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1086      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1087 _GL_CXXALIASWARN1 (wcsstr, wchar_t *,
1088                    (wchar_t *restrict haystack,
1089                     const wchar_t *restrict needle));
1090 _GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
1091                    (const wchar_t *restrict haystack,
1092                     const wchar_t *restrict needle));
1093 # elif __GLIBC__ >= 2
1094 _GL_CXXALIASWARN (wcsstr);
1095 # endif
1096 #elif defined GNULIB_POSIXCHECK
1097 # undef wcsstr
1098 # if HAVE_RAW_DECL_WCSSTR
1099 _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
1100                  "use gnulib module wcsstr for portability");
1101 # endif
1102 #endif
1103 
1104 
1105 /* Divide WCS into tokens separated by characters in DELIM.  */
1106 #if @GNULIB_WCSTOK@
1107 # if @REPLACE_WCSTOK@
1108 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1109 #   undef wcstok
1110 #   define wcstok rpl_wcstok
1111 #  endif
1112 _GL_FUNCDECL_RPL (wcstok, wchar_t *,
1113                   (wchar_t *restrict wcs, const wchar_t *restrict delim,
1114                    wchar_t **restrict ptr));
1115 _GL_CXXALIAS_RPL (wcstok, wchar_t *,
1116                   (wchar_t *restrict wcs, const wchar_t *restrict delim,
1117                    wchar_t **restrict ptr));
1118 # else
1119 #  if !@HAVE_WCSTOK@
1120 _GL_FUNCDECL_SYS (wcstok, wchar_t *,
1121                   (wchar_t *restrict wcs, const wchar_t *restrict delim,
1122                    wchar_t **restrict ptr));
1123 #  endif
1124 _GL_CXXALIAS_SYS (wcstok, wchar_t *,
1125                   (wchar_t *restrict wcs, const wchar_t *restrict delim,
1126                    wchar_t **restrict ptr));
1127 # endif
1128 # if __GLIBC__ >= 2
1129 _GL_CXXALIASWARN (wcstok);
1130 # endif
1131 #elif defined GNULIB_POSIXCHECK
1132 # undef wcstok
1133 # if HAVE_RAW_DECL_WCSTOK
1134 _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
1135                  "use gnulib module wcstok for portability");
1136 # endif
1137 #endif
1138 
1139 
1140 /* Determine number of column positions required for first N wide
1141    characters (or fewer if S ends before this) in S.  */
1142 #if @GNULIB_WCSWIDTH@
1143 # if @REPLACE_WCSWIDTH@
1144 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1145 #   undef wcswidth
1146 #   define wcswidth rpl_wcswidth
1147 #  endif
1148 _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
1149                                  _GL_ATTRIBUTE_PURE);
1150 _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
1151 # else
1152 #  if !@HAVE_WCSWIDTH@
1153 _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
1154                                  _GL_ATTRIBUTE_PURE);
1155 #  endif
1156 _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1157 # endif
1158 # if __GLIBC__ >= 2
1159 _GL_CXXALIASWARN (wcswidth);
1160 # endif
1161 #elif defined GNULIB_POSIXCHECK
1162 # undef wcswidth
1163 # if HAVE_RAW_DECL_WCSWIDTH
1164 _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1165                  "use gnulib module wcswidth for portability");
1166 # endif
1167 #endif
1168 
1169 
1170 /* Convert *TP to a date and time wide string.  See
1171    <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>.  */
1172 #if @GNULIB_WCSFTIME@
1173 # if @REPLACE_WCSFTIME@
1174 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1175 #   undef wcsftime
1176 #   define wcsftime rpl_wcsftime
1177 #  endif
1178 _GL_FUNCDECL_RPL (wcsftime, size_t,
1179                   (wchar_t *restrict __buf, size_t __bufsize,
1180                    const wchar_t *restrict __fmt,
1181                    const struct tm *restrict __tp)
1182                   _GL_ARG_NONNULL ((1, 3, 4)));
1183 _GL_CXXALIAS_RPL (wcsftime, size_t,
1184                   (wchar_t *restrict __buf, size_t __bufsize,
1185                    const wchar_t *restrict __fmt,
1186                    const struct tm *restrict __tp));
1187 # else
1188 #  if !@HAVE_WCSFTIME@
1189 _GL_FUNCDECL_SYS (wcsftime, size_t,
1190                   (wchar_t *restrict __buf, size_t __bufsize,
1191                    const wchar_t *restrict __fmt,
1192                    const struct tm *restrict __tp)
1193                   _GL_ARG_NONNULL ((1, 3, 4)));
1194 #  endif
1195 _GL_CXXALIAS_SYS (wcsftime, size_t,
1196                   (wchar_t *restrict __buf, size_t __bufsize,
1197                    const wchar_t *restrict __fmt,
1198                    const struct tm *restrict __tp));
1199 # endif
1200 # if __GLIBC__ >= 2
1201 _GL_CXXALIASWARN (wcsftime);
1202 # endif
1203 #elif defined GNULIB_POSIXCHECK
1204 # undef wcsftime
1205 # if HAVE_RAW_DECL_WCSFTIME
1206 _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
1207                  "use gnulib module wcsftime for portability");
1208 # endif
1209 #endif
1210 
1211 
1212 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1213 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1214 #endif
1215