1 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
3 Copyright (C) 2007-2023 Free Software Foundation, Inc.
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 This file 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 /* Written by Eric Blake. */
21 * ISO C 99 <wchar.h> for platforms that have issues.
22 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html>
24 * For now, this just ensures proper prerequisite inclusion order and
25 * the declaration of wcwidth().
29 @PRAGMA_SYSTEM_HEADER@
33 #if (((defined __need_mbstate_t || defined __need_wint_t) \
34 && !defined __MINGW32__) \
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. */
55 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
58 /* Normal invocation convention. */
60 #ifndef _@GUARD_PREFIX@_WCHAR_H
62 #define _GL_ALREADY_INCLUDING_WCHAR_H
65 # include <features.h> /* for __GLIBC__ */
68 /* In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
70 But avoid namespace pollution on glibc systems. */
71 #if !(defined __GLIBC__ && !defined __UCLIBC__)
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. */
79 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
82 #undef _GL_ALREADY_INCLUDING_WCHAR_H
84 #ifndef _@GUARD_PREFIX@_WCHAR_H
85 #define _@GUARD_PREFIX@_WCHAR_H
87 /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
88 that can be freed by passing them as the Ith argument to the
90 #ifndef _GL_ATTRIBUTE_DEALLOC
92 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
94 # define _GL_ATTRIBUTE_DEALLOC(f, i)
98 /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
99 can be freed via 'free'; it can be used only after declaring 'free'. */
100 /* Applies to: functions. Cannot be used on inline functions. */
101 #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
102 # if defined __cplusplus && defined __GNUC__ && !defined __clang__
103 /* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
104 # define _GL_ATTRIBUTE_DEALLOC_FREE \
105 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
107 # define _GL_ATTRIBUTE_DEALLOC_FREE \
108 _GL_ATTRIBUTE_DEALLOC (free, 1)
112 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
114 /* Applies to: functions. */
115 #ifndef _GL_ATTRIBUTE_MALLOC
116 # if __GNUC__ >= 3 || defined __clang__
117 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
119 # define _GL_ATTRIBUTE_MALLOC
123 /* The __attribute__ feature is available in gcc versions 2.5 and later.
124 The attribute __pure__ was added in gcc 2.96. */
125 #ifndef _GL_ATTRIBUTE_PURE
126 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
127 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
129 # define _GL_ATTRIBUTE_PURE /* empty */
133 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
135 /* The definition of _GL_ARG_NONNULL is copied here. */
137 /* The definition of _GL_WARN_ON_USE is copied here. */
140 /* Define wint_t and WEOF. (Also done in wctype.in.h.) */
141 #if !@HAVE_WINT_T@ && !defined wint_t
147 /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
148 <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that
149 wint_t must be "unchanged by default argument promotions". Override it. */
150 # if @GNULIBHEADERS_OVERRIDE_WINT_T@
151 # if !GNULIB_defined_wint_t
152 # if @HAVE_CRTDEFS_H@
153 # include <crtdefs.h>
157 typedef unsigned int rpl_wint_t
;
159 # define wint_t rpl_wint_t
160 # define GNULIB_defined_wint_t 1
164 # define WEOF ((wint_t) -1)
169 /* Override mbstate_t if it is too small.
170 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
171 implementing mbrtowc for encodings like UTF-8.
172 On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is
173 large enough and overriding it would cause problems in C++ mode. */
174 #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
175 # if !GNULIB_defined_mbstate_t
176 # if !(defined _AIX || defined _MSC_VER)
177 typedef int rpl_mbstate_t
;
179 # define mbstate_t rpl_mbstate_t
181 # define GNULIB_defined_mbstate_t 1
185 /* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
186 been included yet. */
187 #if @GNULIB_FREE_POSIX@
188 # if (@REPLACE_FREE@ && !defined free \
189 && !(defined __cplusplus && defined GNULIB_NAMESPACE))
190 /* We can't do '#define free rpl_free' here. */
191 _GL_EXTERN_C
void rpl_free (void *);
192 # undef _GL_ATTRIBUTE_DEALLOC_FREE
193 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
195 # if defined _MSC_VER && !defined free
198 __declspec (dllimport
)
200 void __cdecl
free (void *);
202 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
203 _GL_EXTERN_C
void free (void *) throw ();
205 _GL_EXTERN_C
void free (void *);
210 # if defined _MSC_VER && !defined free
213 __declspec (dllimport
)
215 void __cdecl
free (void *);
217 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
218 _GL_EXTERN_C
void free (void *) throw ();
220 _GL_EXTERN_C
void free (void *);
225 /* Convert a single-byte character to a wide character. */
228 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
230 # define btowc rpl_btowc
232 _GL_FUNCDECL_RPL (btowc
, wint_t, (int c
) _GL_ATTRIBUTE_PURE
);
233 _GL_CXXALIAS_RPL (btowc
, wint_t, (int c
));
236 _GL_FUNCDECL_SYS (btowc
, wint_t, (int c
) _GL_ATTRIBUTE_PURE
);
238 /* Need to cast, because on mingw, the return type is 'unsigned short'. */
239 _GL_CXXALIAS_SYS_CAST (btowc
, wint_t, (int c
));
242 _GL_CXXALIASWARN (btowc
);
244 #elif defined GNULIB_POSIXCHECK
246 # if HAVE_RAW_DECL_BTOWC
247 _GL_WARN_ON_USE (btowc
, "btowc is unportable - "
248 "use gnulib module btowc for portability");
253 /* Convert a wide character to a single-byte character. */
256 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
258 # define wctob rpl_wctob
260 _GL_FUNCDECL_RPL (wctob
, int, (wint_t wc
) _GL_ATTRIBUTE_PURE
);
261 _GL_CXXALIAS_RPL (wctob
, int, (wint_t wc
));
263 # if !defined wctob && !@HAVE_DECL_WCTOB@
264 /* wctob is provided by gnulib, or wctob exists but is not declared. */
265 _GL_FUNCDECL_SYS (wctob
, int, (wint_t wc
) _GL_ATTRIBUTE_PURE
);
267 _GL_CXXALIAS_SYS (wctob
, int, (wint_t wc
));
270 _GL_CXXALIASWARN (wctob
);
272 #elif defined GNULIB_POSIXCHECK
274 # if HAVE_RAW_DECL_WCTOB
275 _GL_WARN_ON_USE (wctob
, "wctob is unportable - "
276 "use gnulib module wctob for portability");
281 /* Test whether *PS is in the initial state. */
283 # if @REPLACE_MBSINIT@
284 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
286 # define mbsinit rpl_mbsinit
288 _GL_FUNCDECL_RPL (mbsinit
, int, (const mbstate_t *ps
));
289 _GL_CXXALIAS_RPL (mbsinit
, int, (const mbstate_t *ps
));
292 _GL_FUNCDECL_SYS (mbsinit
, int, (const mbstate_t *ps
));
294 _GL_CXXALIAS_SYS (mbsinit
, int, (const mbstate_t *ps
));
297 _GL_CXXALIASWARN (mbsinit
);
299 #elif defined GNULIB_POSIXCHECK
301 # if HAVE_RAW_DECL_MBSINIT
302 _GL_WARN_ON_USE (mbsinit
, "mbsinit is unportable - "
303 "use gnulib module mbsinit for portability");
308 /* Convert a multibyte character to a wide character. */
310 # if @REPLACE_MBRTOWC@
311 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
313 # define mbrtowc rpl_mbrtowc
315 _GL_FUNCDECL_RPL (mbrtowc
, size_t,
316 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
,
317 mbstate_t *restrict ps
));
318 _GL_CXXALIAS_RPL (mbrtowc
, size_t,
319 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
,
320 mbstate_t *restrict ps
));
323 _GL_FUNCDECL_SYS (mbrtowc
, size_t,
324 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
,
325 mbstate_t *restrict ps
));
327 _GL_CXXALIAS_SYS (mbrtowc
, size_t,
328 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
,
329 mbstate_t *restrict ps
));
332 _GL_CXXALIASWARN (mbrtowc
);
334 #elif defined GNULIB_POSIXCHECK
336 # if HAVE_RAW_DECL_MBRTOWC
337 _GL_WARN_ON_USE (mbrtowc
, "mbrtowc is unportable - "
338 "use gnulib module mbrtowc for portability");
343 /* Recognize a multibyte character. */
345 # if @REPLACE_MBRLEN@
346 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
348 # define mbrlen rpl_mbrlen
350 _GL_FUNCDECL_RPL (mbrlen
, size_t,
351 (const char *restrict s
, size_t n
, mbstate_t *restrict ps
));
352 _GL_CXXALIAS_RPL (mbrlen
, size_t,
353 (const char *restrict s
, size_t n
, mbstate_t *restrict ps
));
356 _GL_FUNCDECL_SYS (mbrlen
, size_t,
357 (const char *restrict s
, size_t n
, mbstate_t *restrict ps
));
359 _GL_CXXALIAS_SYS (mbrlen
, size_t,
360 (const char *restrict s
, size_t n
, mbstate_t *restrict ps
));
363 _GL_CXXALIASWARN (mbrlen
);
365 #elif defined GNULIB_POSIXCHECK
367 # if HAVE_RAW_DECL_MBRLEN
368 _GL_WARN_ON_USE (mbrlen
, "mbrlen is unportable - "
369 "use gnulib module mbrlen for portability");
374 /* Convert a string to a wide string. */
375 #if @GNULIB_MBSRTOWCS@
376 # if @REPLACE_MBSRTOWCS@
377 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
379 # define mbsrtowcs rpl_mbsrtowcs
381 _GL_FUNCDECL_RPL (mbsrtowcs
, size_t,
382 (wchar_t *restrict dest
,
383 const char **restrict srcp
, size_t len
,
384 mbstate_t *restrict ps
)
385 _GL_ARG_NONNULL ((2)));
386 _GL_CXXALIAS_RPL (mbsrtowcs
, size_t,
387 (wchar_t *restrict dest
,
388 const char **restrict srcp
, size_t len
,
389 mbstate_t *restrict ps
));
391 # if !@HAVE_MBSRTOWCS@
392 _GL_FUNCDECL_SYS (mbsrtowcs
, size_t,
393 (wchar_t *restrict dest
,
394 const char **restrict srcp
, size_t len
,
395 mbstate_t *restrict ps
)
396 _GL_ARG_NONNULL ((2)));
398 _GL_CXXALIAS_SYS (mbsrtowcs
, size_t,
399 (wchar_t *restrict dest
,
400 const char **restrict srcp
, size_t len
,
401 mbstate_t *restrict ps
));
404 _GL_CXXALIASWARN (mbsrtowcs
);
406 #elif defined GNULIB_POSIXCHECK
408 # if HAVE_RAW_DECL_MBSRTOWCS
409 _GL_WARN_ON_USE (mbsrtowcs
, "mbsrtowcs is unportable - "
410 "use gnulib module mbsrtowcs for portability");
415 /* Convert a string to a wide string. */
416 #if @GNULIB_MBSNRTOWCS@
417 # if @REPLACE_MBSNRTOWCS@
418 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
420 # define mbsnrtowcs rpl_mbsnrtowcs
422 _GL_FUNCDECL_RPL (mbsnrtowcs
, size_t,
423 (wchar_t *restrict dest
,
424 const char **restrict srcp
, size_t srclen
, size_t len
,
425 mbstate_t *restrict ps
)
426 _GL_ARG_NONNULL ((2)));
427 _GL_CXXALIAS_RPL (mbsnrtowcs
, size_t,
428 (wchar_t *restrict dest
,
429 const char **restrict srcp
, size_t srclen
, size_t len
,
430 mbstate_t *restrict ps
));
432 # if !@HAVE_MBSNRTOWCS@
433 _GL_FUNCDECL_SYS (mbsnrtowcs
, size_t,
434 (wchar_t *restrict dest
,
435 const char **restrict srcp
, size_t srclen
, size_t len
,
436 mbstate_t *restrict ps
)
437 _GL_ARG_NONNULL ((2)));
439 _GL_CXXALIAS_SYS (mbsnrtowcs
, size_t,
440 (wchar_t *restrict dest
,
441 const char **restrict srcp
, size_t srclen
, size_t len
,
442 mbstate_t *restrict ps
));
444 _GL_CXXALIASWARN (mbsnrtowcs
);
445 #elif defined GNULIB_POSIXCHECK
447 # if HAVE_RAW_DECL_MBSNRTOWCS
448 _GL_WARN_ON_USE (mbsnrtowcs
, "mbsnrtowcs is unportable - "
449 "use gnulib module mbsnrtowcs for portability");
454 /* Convert a wide character to a multibyte character. */
456 # if @REPLACE_WCRTOMB@
457 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
459 # define wcrtomb rpl_wcrtomb
461 _GL_FUNCDECL_RPL (wcrtomb
, size_t,
462 (char *restrict s
, wchar_t wc
, mbstate_t *restrict ps
));
463 _GL_CXXALIAS_RPL (wcrtomb
, size_t,
464 (char *restrict s
, wchar_t wc
, mbstate_t *restrict ps
));
467 _GL_FUNCDECL_SYS (wcrtomb
, size_t,
468 (char *restrict s
, wchar_t wc
, mbstate_t *restrict ps
));
470 _GL_CXXALIAS_SYS (wcrtomb
, size_t,
471 (char *restrict s
, wchar_t wc
, mbstate_t *restrict ps
));
474 _GL_CXXALIASWARN (wcrtomb
);
476 #elif defined GNULIB_POSIXCHECK
478 # if HAVE_RAW_DECL_WCRTOMB
479 _GL_WARN_ON_USE (wcrtomb
, "wcrtomb is unportable - "
480 "use gnulib module wcrtomb for portability");
485 /* Convert a wide string to a string. */
486 #if @GNULIB_WCSRTOMBS@
487 # if @REPLACE_WCSRTOMBS@
488 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
490 # define wcsrtombs rpl_wcsrtombs
492 _GL_FUNCDECL_RPL (wcsrtombs
, size_t,
493 (char *restrict dest
, const wchar_t **restrict srcp
,
495 mbstate_t *restrict ps
)
496 _GL_ARG_NONNULL ((2)));
497 _GL_CXXALIAS_RPL (wcsrtombs
, size_t,
498 (char *restrict dest
, const wchar_t **restrict srcp
,
500 mbstate_t *restrict ps
));
502 # if !@HAVE_WCSRTOMBS@
503 _GL_FUNCDECL_SYS (wcsrtombs
, size_t,
504 (char *restrict dest
, const wchar_t **restrict srcp
,
506 mbstate_t *restrict ps
)
507 _GL_ARG_NONNULL ((2)));
509 _GL_CXXALIAS_SYS (wcsrtombs
, size_t,
510 (char *restrict dest
, const wchar_t **restrict srcp
,
512 mbstate_t *restrict ps
));
515 _GL_CXXALIASWARN (wcsrtombs
);
517 #elif defined GNULIB_POSIXCHECK
519 # if HAVE_RAW_DECL_WCSRTOMBS
520 _GL_WARN_ON_USE (wcsrtombs
, "wcsrtombs is unportable - "
521 "use gnulib module wcsrtombs for portability");
526 /* Convert a wide string to a string. */
527 #if @GNULIB_WCSNRTOMBS@
528 # if @REPLACE_WCSNRTOMBS@
529 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
531 # define wcsnrtombs rpl_wcsnrtombs
533 _GL_FUNCDECL_RPL (wcsnrtombs
, size_t,
534 (char *restrict dest
,
535 const wchar_t **restrict srcp
, size_t srclen
,
537 mbstate_t *restrict ps
)
538 _GL_ARG_NONNULL ((2)));
539 _GL_CXXALIAS_RPL (wcsnrtombs
, size_t,
540 (char *restrict dest
,
541 const wchar_t **restrict srcp
, size_t srclen
,
543 mbstate_t *restrict ps
));
545 # if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
546 _GL_FUNCDECL_SYS (wcsnrtombs
, size_t,
547 (char *restrict dest
,
548 const wchar_t **restrict srcp
, size_t srclen
,
550 mbstate_t *restrict ps
)
551 _GL_ARG_NONNULL ((2)));
553 _GL_CXXALIAS_SYS (wcsnrtombs
, size_t,
554 (char *restrict dest
,
555 const wchar_t **restrict srcp
, size_t srclen
,
557 mbstate_t *restrict ps
));
560 _GL_CXXALIASWARN (wcsnrtombs
);
562 #elif defined GNULIB_POSIXCHECK
564 # if HAVE_RAW_DECL_WCSNRTOMBS
565 _GL_WARN_ON_USE (wcsnrtombs
, "wcsnrtombs is unportable - "
566 "use gnulib module wcsnrtombs for portability");
571 /* Return the number of screen columns needed for WC. */
573 # if @REPLACE_WCWIDTH@
574 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
576 # define wcwidth rpl_wcwidth
578 _GL_FUNCDECL_RPL (wcwidth
, int, (wchar_t) _GL_ATTRIBUTE_PURE
);
579 _GL_CXXALIAS_RPL (wcwidth
, int, (wchar_t));
581 # if !@HAVE_DECL_WCWIDTH@
582 /* wcwidth exists but is not declared. */
583 _GL_FUNCDECL_SYS (wcwidth
, int, (wchar_t) _GL_ATTRIBUTE_PURE
);
585 _GL_CXXALIAS_SYS (wcwidth
, int, (wchar_t));
588 _GL_CXXALIASWARN (wcwidth
);
590 #elif defined GNULIB_POSIXCHECK
592 # if HAVE_RAW_DECL_WCWIDTH
593 _GL_WARN_ON_USE (wcwidth
, "wcwidth is unportable - "
594 "use gnulib module wcwidth for portability");
599 /* Search N wide characters of S for C. */
602 _GL_FUNCDECL_SYS (wmemchr
, wchar_t *, (const wchar_t *s
, wchar_t c
, size_t n
)
605 /* On some systems, this function is defined as an overloaded function:
607 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
608 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
610 _GL_CXXALIAS_SYS_CAST2 (wmemchr
,
611 wchar_t *, (const wchar_t *, wchar_t, size_t),
612 const wchar_t *, (const wchar_t *, wchar_t, size_t));
613 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
614 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
615 _GL_CXXALIASWARN1 (wmemchr
, wchar_t *, (wchar_t *s
, wchar_t c
, size_t n
));
616 _GL_CXXALIASWARN1 (wmemchr
, const wchar_t *,
617 (const wchar_t *s
, wchar_t c
, size_t n
));
618 # elif __GLIBC__ >= 2
619 _GL_CXXALIASWARN (wmemchr
);
621 #elif defined GNULIB_POSIXCHECK
623 # if HAVE_RAW_DECL_WMEMCHR
624 _GL_WARN_ON_USE (wmemchr
, "wmemchr is unportable - "
625 "use gnulib module wmemchr for portability");
630 /* Compare N wide characters of S1 and S2. */
633 _GL_FUNCDECL_SYS (wmemcmp
, int,
634 (const wchar_t *s1
, const wchar_t *s2
, size_t n
)
637 _GL_CXXALIAS_SYS (wmemcmp
, int,
638 (const wchar_t *s1
, const wchar_t *s2
, size_t n
));
640 _GL_CXXALIASWARN (wmemcmp
);
642 #elif defined GNULIB_POSIXCHECK
644 # if HAVE_RAW_DECL_WMEMCMP
645 _GL_WARN_ON_USE (wmemcmp
, "wmemcmp is unportable - "
646 "use gnulib module wmemcmp for portability");
651 /* Copy N wide characters of SRC to DEST. */
654 _GL_FUNCDECL_SYS (wmemcpy
, wchar_t *,
655 (wchar_t *restrict dest
,
656 const wchar_t *restrict src
, size_t n
));
658 _GL_CXXALIAS_SYS (wmemcpy
, wchar_t *,
659 (wchar_t *restrict dest
,
660 const wchar_t *restrict src
, size_t n
));
662 _GL_CXXALIASWARN (wmemcpy
);
664 #elif defined GNULIB_POSIXCHECK
666 # if HAVE_RAW_DECL_WMEMCPY
667 _GL_WARN_ON_USE (wmemcpy
, "wmemcpy is unportable - "
668 "use gnulib module wmemcpy for portability");
673 /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
674 overlapping memory areas. */
675 #if @GNULIB_WMEMMOVE@
676 # if !@HAVE_WMEMMOVE@
677 _GL_FUNCDECL_SYS (wmemmove
, wchar_t *,
678 (wchar_t *dest
, const wchar_t *src
, size_t n
));
680 _GL_CXXALIAS_SYS (wmemmove
, wchar_t *,
681 (wchar_t *dest
, const wchar_t *src
, size_t n
));
683 _GL_CXXALIASWARN (wmemmove
);
685 #elif defined GNULIB_POSIXCHECK
687 # if HAVE_RAW_DECL_WMEMMOVE
688 _GL_WARN_ON_USE (wmemmove
, "wmemmove is unportable - "
689 "use gnulib module wmemmove for portability");
694 /* Copy N wide characters of SRC to DEST.
695 Return pointer to wide characters after the last written wide character. */
696 #if @GNULIB_WMEMPCPY@
697 # if !@HAVE_WMEMPCPY@
698 _GL_FUNCDECL_SYS (wmempcpy
, wchar_t *,
699 (wchar_t *restrict dest
,
700 const wchar_t *restrict src
, size_t n
));
702 _GL_CXXALIAS_SYS (wmempcpy
, wchar_t *,
703 (wchar_t *restrict dest
,
704 const wchar_t *restrict src
, size_t n
));
706 _GL_CXXALIASWARN (wmempcpy
);
708 #elif defined GNULIB_POSIXCHECK
710 # if HAVE_RAW_DECL_WMEMPCPY
711 _GL_WARN_ON_USE (wmempcpy
, "wmempcpy is unportable - "
712 "use gnulib module wmempcpy for portability");
717 /* Set N wide characters of S to C. */
720 _GL_FUNCDECL_SYS (wmemset
, wchar_t *, (wchar_t *s
, wchar_t c
, size_t n
));
722 _GL_CXXALIAS_SYS (wmemset
, wchar_t *, (wchar_t *s
, wchar_t c
, size_t n
));
724 _GL_CXXALIASWARN (wmemset
);
726 #elif defined GNULIB_POSIXCHECK
728 # if HAVE_RAW_DECL_WMEMSET
729 _GL_WARN_ON_USE (wmemset
, "wmemset is unportable - "
730 "use gnulib module wmemset for portability");
735 /* Return the number of wide characters in S. */
738 _GL_FUNCDECL_SYS (wcslen
, size_t, (const wchar_t *s
) _GL_ATTRIBUTE_PURE
);
740 _GL_CXXALIAS_SYS (wcslen
, size_t, (const wchar_t *s
));
742 _GL_CXXALIASWARN (wcslen
);
744 #elif defined GNULIB_POSIXCHECK
746 # if HAVE_RAW_DECL_WCSLEN
747 _GL_WARN_ON_USE (wcslen
, "wcslen is unportable - "
748 "use gnulib module wcslen for portability");
753 /* Return the number of wide characters in S, but at most MAXLEN. */
755 /* On Solaris 11.3, the header files declare the function in the std::
756 namespace, not in the global namespace. So, force a declaration in
757 the global namespace. */
758 # if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus)
759 _GL_FUNCDECL_SYS (wcsnlen
, size_t, (const wchar_t *s
, size_t maxlen
)
762 _GL_CXXALIAS_SYS (wcsnlen
, size_t, (const wchar_t *s
, size_t maxlen
));
763 _GL_CXXALIASWARN (wcsnlen
);
764 #elif defined GNULIB_POSIXCHECK
766 # if HAVE_RAW_DECL_WCSNLEN
767 _GL_WARN_ON_USE (wcsnlen
, "wcsnlen is unportable - "
768 "use gnulib module wcsnlen for portability");
773 /* Copy SRC to DEST. */
776 _GL_FUNCDECL_SYS (wcscpy
, wchar_t *,
777 (wchar_t *restrict dest
, const wchar_t *restrict src
));
779 _GL_CXXALIAS_SYS (wcscpy
, wchar_t *,
780 (wchar_t *restrict dest
, const wchar_t *restrict src
));
782 _GL_CXXALIASWARN (wcscpy
);
784 #elif defined GNULIB_POSIXCHECK
786 # if HAVE_RAW_DECL_WCSCPY
787 _GL_WARN_ON_USE (wcscpy
, "wcscpy is unportable - "
788 "use gnulib module wcscpy for portability");
793 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
795 /* On Solaris 11.3, the header files declare the function in the std::
796 namespace, not in the global namespace. So, force a declaration in
797 the global namespace. */
798 # if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus)
799 _GL_FUNCDECL_SYS (wcpcpy
, wchar_t *,
800 (wchar_t *restrict dest
, const wchar_t *restrict src
));
802 _GL_CXXALIAS_SYS (wcpcpy
, wchar_t *,
803 (wchar_t *restrict dest
, const wchar_t *restrict src
));
804 _GL_CXXALIASWARN (wcpcpy
);
805 #elif defined GNULIB_POSIXCHECK
807 # if HAVE_RAW_DECL_WCPCPY
808 _GL_WARN_ON_USE (wcpcpy
, "wcpcpy is unportable - "
809 "use gnulib module wcpcpy for portability");
814 /* Copy no more than N wide characters of SRC to DEST. */
817 _GL_FUNCDECL_SYS (wcsncpy
, wchar_t *,
818 (wchar_t *restrict dest
,
819 const wchar_t *restrict src
, size_t n
));
821 _GL_CXXALIAS_SYS (wcsncpy
, wchar_t *,
822 (wchar_t *restrict dest
,
823 const wchar_t *restrict src
, size_t n
));
825 _GL_CXXALIASWARN (wcsncpy
);
827 #elif defined GNULIB_POSIXCHECK
829 # if HAVE_RAW_DECL_WCSNCPY
830 _GL_WARN_ON_USE (wcsncpy
, "wcsncpy is unportable - "
831 "use gnulib module wcsncpy for portability");
836 /* Copy no more than N characters of SRC to DEST, returning the address of
837 the last character written into DEST. */
839 /* On Solaris 11.3, the header files declare the function in the std::
840 namespace, not in the global namespace. So, force a declaration in
841 the global namespace. */
842 # if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus)
843 _GL_FUNCDECL_SYS (wcpncpy
, wchar_t *,
844 (wchar_t *restrict dest
,
845 const wchar_t *restrict src
, size_t n
));
847 _GL_CXXALIAS_SYS (wcpncpy
, wchar_t *,
848 (wchar_t *restrict dest
,
849 const wchar_t *restrict src
, size_t n
));
850 _GL_CXXALIASWARN (wcpncpy
);
851 #elif defined GNULIB_POSIXCHECK
853 # if HAVE_RAW_DECL_WCPNCPY
854 _GL_WARN_ON_USE (wcpncpy
, "wcpncpy is unportable - "
855 "use gnulib module wcpncpy for portability");
860 /* Append SRC onto DEST. */
863 _GL_FUNCDECL_SYS (wcscat
, wchar_t *,
864 (wchar_t *restrict dest
, const wchar_t *restrict src
));
866 _GL_CXXALIAS_SYS (wcscat
, wchar_t *,
867 (wchar_t *restrict dest
, const wchar_t *restrict src
));
869 _GL_CXXALIASWARN (wcscat
);
871 #elif defined GNULIB_POSIXCHECK
873 # if HAVE_RAW_DECL_WCSCAT
874 _GL_WARN_ON_USE (wcscat
, "wcscat is unportable - "
875 "use gnulib module wcscat for portability");
880 /* Append no more than N wide characters of SRC onto DEST. */
883 _GL_FUNCDECL_SYS (wcsncat
, wchar_t *,
884 (wchar_t *restrict dest
, const wchar_t *restrict src
,
887 _GL_CXXALIAS_SYS (wcsncat
, wchar_t *,
888 (wchar_t *restrict dest
, const wchar_t *restrict src
,
891 _GL_CXXALIASWARN (wcsncat
);
893 #elif defined GNULIB_POSIXCHECK
895 # if HAVE_RAW_DECL_WCSNCAT
896 _GL_WARN_ON_USE (wcsncat
, "wcsncat is unportable - "
897 "use gnulib module wcsncat for portability");
902 /* Compare S1 and S2. */
905 _GL_FUNCDECL_SYS (wcscmp
, int, (const wchar_t *s1
, const wchar_t *s2
)
908 _GL_CXXALIAS_SYS (wcscmp
, int, (const wchar_t *s1
, const wchar_t *s2
));
910 _GL_CXXALIASWARN (wcscmp
);
912 #elif defined GNULIB_POSIXCHECK
914 # if HAVE_RAW_DECL_WCSCMP
915 _GL_WARN_ON_USE (wcscmp
, "wcscmp is unportable - "
916 "use gnulib module wcscmp for portability");
921 /* Compare no more than N wide characters of S1 and S2. */
924 _GL_FUNCDECL_SYS (wcsncmp
, int,
925 (const wchar_t *s1
, const wchar_t *s2
, size_t n
)
928 _GL_CXXALIAS_SYS (wcsncmp
, int,
929 (const wchar_t *s1
, const wchar_t *s2
, size_t n
));
931 _GL_CXXALIASWARN (wcsncmp
);
933 #elif defined GNULIB_POSIXCHECK
935 # if HAVE_RAW_DECL_WCSNCMP
936 _GL_WARN_ON_USE (wcsncmp
, "wcsncmp is unportable - "
937 "use gnulib module wcsncmp for portability");
942 /* Compare S1 and S2, ignoring case. */
943 #if @GNULIB_WCSCASECMP@
944 /* On Solaris 11.3, the header files declare the function in the std::
945 namespace, not in the global namespace. So, force a declaration in
946 the global namespace. */
947 # if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus)
948 _GL_FUNCDECL_SYS (wcscasecmp
, int, (const wchar_t *s1
, const wchar_t *s2
)
951 _GL_CXXALIAS_SYS (wcscasecmp
, int, (const wchar_t *s1
, const wchar_t *s2
));
952 _GL_CXXALIASWARN (wcscasecmp
);
953 #elif defined GNULIB_POSIXCHECK
955 # if HAVE_RAW_DECL_WCSCASECMP
956 _GL_WARN_ON_USE (wcscasecmp
, "wcscasecmp is unportable - "
957 "use gnulib module wcscasecmp for portability");
962 /* Compare no more than N chars of S1 and S2, ignoring case. */
963 #if @GNULIB_WCSNCASECMP@
964 /* On Solaris 11.3, the header files declare the function in the std::
965 namespace, not in the global namespace. So, force a declaration in
966 the global namespace. */
967 # if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus)
968 _GL_FUNCDECL_SYS (wcsncasecmp
, int,
969 (const wchar_t *s1
, const wchar_t *s2
, size_t n
)
972 _GL_CXXALIAS_SYS (wcsncasecmp
, int,
973 (const wchar_t *s1
, const wchar_t *s2
, size_t n
));
974 _GL_CXXALIASWARN (wcsncasecmp
);
975 #elif defined GNULIB_POSIXCHECK
977 # if HAVE_RAW_DECL_WCSNCASECMP
978 _GL_WARN_ON_USE (wcsncasecmp
, "wcsncasecmp is unportable - "
979 "use gnulib module wcsncasecmp for portability");
984 /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
985 category of the current locale. */
988 _GL_FUNCDECL_SYS (wcscoll
, int, (const wchar_t *s1
, const wchar_t *s2
));
990 _GL_CXXALIAS_SYS (wcscoll
, int, (const wchar_t *s1
, const wchar_t *s2
));
992 _GL_CXXALIASWARN (wcscoll
);
994 #elif defined GNULIB_POSIXCHECK
996 # if HAVE_RAW_DECL_WCSCOLL
997 _GL_WARN_ON_USE (wcscoll
, "wcscoll is unportable - "
998 "use gnulib module wcscoll for portability");
1003 /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
1004 to two transformed strings the result is the as applying 'wcscoll' to the
1005 original strings. */
1006 #if @GNULIB_WCSXFRM@
1007 # if !@HAVE_WCSXFRM@
1008 _GL_FUNCDECL_SYS (wcsxfrm
, size_t,
1009 (wchar_t *restrict s1
, const wchar_t *restrict s2
, size_t n
));
1011 _GL_CXXALIAS_SYS (wcsxfrm
, size_t,
1012 (wchar_t *restrict s1
, const wchar_t *restrict s2
, size_t n
));
1014 _GL_CXXALIASWARN (wcsxfrm
);
1016 #elif defined GNULIB_POSIXCHECK
1018 # if HAVE_RAW_DECL_WCSXFRM
1019 _GL_WARN_ON_USE (wcsxfrm
, "wcsxfrm is unportable - "
1020 "use gnulib module wcsxfrm for portability");
1025 /* Duplicate S, returning an identical malloc'd string. */
1027 # if defined _WIN32 && !defined __CYGWIN__
1028 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1030 # define wcsdup _wcsdup
1032 _GL_CXXALIAS_MDA (wcsdup
, wchar_t *, (const wchar_t *s
));
1034 /* On Solaris 11.3, the header files declare the function in the std::
1035 namespace, not in the global namespace. So, force a declaration in
1036 the global namespace. */
1037 # if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11
1038 _GL_FUNCDECL_SYS (wcsdup
, wchar_t *,
1040 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
1042 _GL_CXXALIAS_SYS (wcsdup
, wchar_t *, (const wchar_t *s
));
1044 _GL_CXXALIASWARN (wcsdup
);
1046 # if __GNUC__ >= 11 && !defined wcsdup
1047 /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */
1048 _GL_FUNCDECL_SYS (wcsdup
, wchar_t *,
1050 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
1052 # if defined GNULIB_POSIXCHECK
1054 # if HAVE_RAW_DECL_WCSDUP
1055 _GL_WARN_ON_USE (wcsdup
, "wcsdup is unportable - "
1056 "use gnulib module wcsdup for portability");
1058 # elif @GNULIB_MDA_WCSDUP@
1059 /* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not
1060 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1061 platforms by defining GNULIB_NAMESPACE::wcsdup always. */
1062 # if defined _WIN32 && !defined __CYGWIN__
1063 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1065 # define wcsdup _wcsdup
1067 _GL_CXXALIAS_MDA (wcsdup
, wchar_t *, (const wchar_t *s
));
1069 _GL_FUNCDECL_SYS (wcsdup
, wchar_t *,
1071 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
1072 # if @HAVE_DECL_WCSDUP@
1073 _GL_CXXALIAS_SYS (wcsdup
, wchar_t *, (const wchar_t *s
));
1076 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
1077 _GL_CXXALIASWARN (wcsdup
);
1083 /* Find the first occurrence of WC in WCS. */
1086 _GL_FUNCDECL_SYS (wcschr
, wchar_t *, (const wchar_t *wcs
, wchar_t wc
)
1087 _GL_ATTRIBUTE_PURE
);
1089 /* On some systems, this function is defined as an overloaded function:
1091 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
1092 wchar_t * std::wcschr (wchar_t *, wchar_t);
1094 _GL_CXXALIAS_SYS_CAST2 (wcschr
,
1095 wchar_t *, (const wchar_t *, wchar_t),
1096 const wchar_t *, (const wchar_t *, wchar_t));
1097 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1098 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1099 _GL_CXXALIASWARN1 (wcschr
, wchar_t *, (wchar_t *wcs
, wchar_t wc
));
1100 _GL_CXXALIASWARN1 (wcschr
, const wchar_t *, (const wchar_t *wcs
, wchar_t wc
));
1101 # elif __GLIBC__ >= 2
1102 _GL_CXXALIASWARN (wcschr
);
1104 #elif defined GNULIB_POSIXCHECK
1106 # if HAVE_RAW_DECL_WCSCHR
1107 _GL_WARN_ON_USE (wcschr
, "wcschr is unportable - "
1108 "use gnulib module wcschr for portability");
1113 /* Find the last occurrence of WC in WCS. */
1114 #if @GNULIB_WCSRCHR@
1115 # if !@HAVE_WCSRCHR@
1116 _GL_FUNCDECL_SYS (wcsrchr
, wchar_t *, (const wchar_t *wcs
, wchar_t wc
)
1117 _GL_ATTRIBUTE_PURE
);
1119 /* On some systems, this function is defined as an overloaded function:
1121 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
1122 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
1124 _GL_CXXALIAS_SYS_CAST2 (wcsrchr
,
1125 wchar_t *, (const wchar_t *, wchar_t),
1126 const wchar_t *, (const wchar_t *, wchar_t));
1127 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1128 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1129 _GL_CXXALIASWARN1 (wcsrchr
, wchar_t *, (wchar_t *wcs
, wchar_t wc
));
1130 _GL_CXXALIASWARN1 (wcsrchr
, const wchar_t *, (const wchar_t *wcs
, wchar_t wc
));
1131 # elif __GLIBC__ >= 2
1132 _GL_CXXALIASWARN (wcsrchr
);
1134 #elif defined GNULIB_POSIXCHECK
1136 # if HAVE_RAW_DECL_WCSRCHR
1137 _GL_WARN_ON_USE (wcsrchr
, "wcsrchr is unportable - "
1138 "use gnulib module wcsrchr for portability");
1143 /* Return the length of the initial segmet of WCS which consists entirely
1144 of wide characters not in REJECT. */
1145 #if @GNULIB_WCSCSPN@
1146 # if !@HAVE_WCSCSPN@
1147 _GL_FUNCDECL_SYS (wcscspn
, size_t, (const wchar_t *wcs
, const wchar_t *reject
)
1148 _GL_ATTRIBUTE_PURE
);
1150 _GL_CXXALIAS_SYS (wcscspn
, size_t, (const wchar_t *wcs
, const wchar_t *reject
));
1152 _GL_CXXALIASWARN (wcscspn
);
1154 #elif defined GNULIB_POSIXCHECK
1156 # if HAVE_RAW_DECL_WCSCSPN
1157 _GL_WARN_ON_USE (wcscspn
, "wcscspn is unportable - "
1158 "use gnulib module wcscspn for portability");
1163 /* Return the length of the initial segmet of WCS which consists entirely
1164 of wide characters in ACCEPT. */
1167 _GL_FUNCDECL_SYS (wcsspn
, size_t, (const wchar_t *wcs
, const wchar_t *accept
)
1168 _GL_ATTRIBUTE_PURE
);
1170 _GL_CXXALIAS_SYS (wcsspn
, size_t, (const wchar_t *wcs
, const wchar_t *accept
));
1172 _GL_CXXALIASWARN (wcsspn
);
1174 #elif defined GNULIB_POSIXCHECK
1176 # if HAVE_RAW_DECL_WCSSPN
1177 _GL_WARN_ON_USE (wcsspn
, "wcsspn is unportable - "
1178 "use gnulib module wcsspn for portability");
1183 /* Find the first occurrence in WCS of any character in ACCEPT. */
1184 #if @GNULIB_WCSPBRK@
1185 # if !@HAVE_WCSPBRK@
1186 _GL_FUNCDECL_SYS (wcspbrk
, wchar_t *,
1187 (const wchar_t *wcs
, const wchar_t *accept
)
1188 _GL_ATTRIBUTE_PURE
);
1190 /* On some systems, this function is defined as an overloaded function:
1192 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
1193 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
1195 _GL_CXXALIAS_SYS_CAST2 (wcspbrk
,
1196 wchar_t *, (const wchar_t *, const wchar_t *),
1197 const wchar_t *, (const wchar_t *, const wchar_t *));
1198 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1199 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1200 _GL_CXXALIASWARN1 (wcspbrk
, wchar_t *,
1201 (wchar_t *wcs
, const wchar_t *accept
));
1202 _GL_CXXALIASWARN1 (wcspbrk
, const wchar_t *,
1203 (const wchar_t *wcs
, const wchar_t *accept
));
1204 # elif __GLIBC__ >= 2
1205 _GL_CXXALIASWARN (wcspbrk
);
1207 #elif defined GNULIB_POSIXCHECK
1209 # if HAVE_RAW_DECL_WCSPBRK
1210 _GL_WARN_ON_USE (wcspbrk
, "wcspbrk is unportable - "
1211 "use gnulib module wcspbrk for portability");
1216 /* Find the first occurrence of NEEDLE in HAYSTACK. */
1219 _GL_FUNCDECL_SYS (wcsstr
, wchar_t *,
1220 (const wchar_t *restrict haystack
,
1221 const wchar_t *restrict needle
)
1222 _GL_ATTRIBUTE_PURE
);
1224 /* On some systems, this function is defined as an overloaded function:
1226 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
1227 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
1229 _GL_CXXALIAS_SYS_CAST2 (wcsstr
,
1231 (const wchar_t *restrict
, const wchar_t *restrict
),
1233 (const wchar_t *restrict
, const wchar_t *restrict
));
1234 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1235 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1236 _GL_CXXALIASWARN1 (wcsstr
, wchar_t *,
1237 (wchar_t *restrict haystack
,
1238 const wchar_t *restrict needle
));
1239 _GL_CXXALIASWARN1 (wcsstr
, const wchar_t *,
1240 (const wchar_t *restrict haystack
,
1241 const wchar_t *restrict needle
));
1242 # elif __GLIBC__ >= 2
1243 _GL_CXXALIASWARN (wcsstr
);
1245 #elif defined GNULIB_POSIXCHECK
1247 # if HAVE_RAW_DECL_WCSSTR
1248 _GL_WARN_ON_USE (wcsstr
, "wcsstr is unportable - "
1249 "use gnulib module wcsstr for portability");
1254 /* Divide WCS into tokens separated by characters in DELIM. */
1256 # if @REPLACE_WCSTOK@
1257 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1259 # define wcstok rpl_wcstok
1261 _GL_FUNCDECL_RPL (wcstok
, wchar_t *,
1262 (wchar_t *restrict wcs
, const wchar_t *restrict delim
,
1263 wchar_t **restrict ptr
));
1264 _GL_CXXALIAS_RPL (wcstok
, wchar_t *,
1265 (wchar_t *restrict wcs
, const wchar_t *restrict delim
,
1266 wchar_t **restrict ptr
));
1269 _GL_FUNCDECL_SYS (wcstok
, wchar_t *,
1270 (wchar_t *restrict wcs
, const wchar_t *restrict delim
,
1271 wchar_t **restrict ptr
));
1273 _GL_CXXALIAS_SYS (wcstok
, wchar_t *,
1274 (wchar_t *restrict wcs
, const wchar_t *restrict delim
,
1275 wchar_t **restrict ptr
));
1278 _GL_CXXALIASWARN (wcstok
);
1280 #elif defined GNULIB_POSIXCHECK
1282 # if HAVE_RAW_DECL_WCSTOK
1283 _GL_WARN_ON_USE (wcstok
, "wcstok is unportable - "
1284 "use gnulib module wcstok for portability");
1289 /* Determine number of column positions required for first N wide
1290 characters (or fewer if S ends before this) in S. */
1291 #if @GNULIB_WCSWIDTH@
1292 # if @REPLACE_WCSWIDTH@
1293 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1295 # define wcswidth rpl_wcswidth
1297 _GL_FUNCDECL_RPL (wcswidth
, int, (const wchar_t *s
, size_t n
)
1298 _GL_ATTRIBUTE_PURE
);
1299 _GL_CXXALIAS_RPL (wcswidth
, int, (const wchar_t *s
, size_t n
));
1301 # if !@HAVE_WCSWIDTH@
1302 _GL_FUNCDECL_SYS (wcswidth
, int, (const wchar_t *s
, size_t n
)
1303 _GL_ATTRIBUTE_PURE
);
1305 _GL_CXXALIAS_SYS (wcswidth
, int, (const wchar_t *s
, size_t n
));
1308 _GL_CXXALIASWARN (wcswidth
);
1310 #elif defined GNULIB_POSIXCHECK
1312 # if HAVE_RAW_DECL_WCSWIDTH
1313 _GL_WARN_ON_USE (wcswidth
, "wcswidth is unportable - "
1314 "use gnulib module wcswidth for portability");
1319 /* Convert *TP to a date and time wide string. See
1320 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */
1321 #if @GNULIB_WCSFTIME@
1322 # if @REPLACE_WCSFTIME@
1323 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1325 # define wcsftime rpl_wcsftime
1327 _GL_FUNCDECL_RPL (wcsftime
, size_t,
1328 (wchar_t *restrict __buf
, size_t __bufsize
,
1329 const wchar_t *restrict __fmt
,
1330 const struct tm
*restrict __tp
)
1331 _GL_ARG_NONNULL ((1, 3, 4)));
1332 _GL_CXXALIAS_RPL (wcsftime
, size_t,
1333 (wchar_t *restrict __buf
, size_t __bufsize
,
1334 const wchar_t *restrict __fmt
,
1335 const struct tm
*restrict __tp
));
1337 # if !@HAVE_WCSFTIME@
1338 _GL_FUNCDECL_SYS (wcsftime
, size_t,
1339 (wchar_t *restrict __buf
, size_t __bufsize
,
1340 const wchar_t *restrict __fmt
,
1341 const struct tm
*restrict __tp
)
1342 _GL_ARG_NONNULL ((1, 3, 4)));
1344 _GL_CXXALIAS_SYS (wcsftime
, size_t,
1345 (wchar_t *restrict __buf
, size_t __bufsize
,
1346 const wchar_t *restrict __fmt
,
1347 const struct tm
*restrict __tp
));
1350 _GL_CXXALIASWARN (wcsftime
);
1352 #elif defined GNULIB_POSIXCHECK
1354 # if HAVE_RAW_DECL_WCSFTIME
1355 _GL_WARN_ON_USE (wcsftime
, "wcsftime is unportable - "
1356 "use gnulib module wcsftime for portability");
1361 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1362 #endif /* _@GUARD_PREFIX@_WCHAR_H */