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