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