1 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
3 Copyright (C) 2007-2022 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 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
105 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
107 /* Applies to: functions. */
108 #ifndef _GL_ATTRIBUTE_MALLOC
109 # if __GNUC__ >= 3 || defined __clang__
110 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
112 # define _GL_ATTRIBUTE_MALLOC
116 /* The __attribute__ feature is available in gcc versions 2.5 and later.
117 The attribute __pure__ was added in gcc 2.96. */
118 #ifndef _GL_ATTRIBUTE_PURE
119 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
120 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
122 # define _GL_ATTRIBUTE_PURE /* empty */
126 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
128 /* The definition of _GL_ARG_NONNULL is copied here. */
130 /* The definition of _GL_WARN_ON_USE is copied here. */
133 /* Define wint_t and WEOF. (Also done in wctype.in.h.) */
134 #if !@HAVE_WINT_T@ && !defined wint_t
140 /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
141 <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that
142 wint_t must be "unchanged by default argument promotions". Override it. */
143 # if @GNULIBHEADERS_OVERRIDE_WINT_T@
144 # if !GNULIB_defined_wint_t
145 # if @HAVE_CRTDEFS_H@
146 # include <crtdefs.h>
150 typedef unsigned int rpl_wint_t
;
152 # define wint_t rpl_wint_t
153 # define GNULIB_defined_wint_t 1
157 # define WEOF ((wint_t) -1)
162 /* Override mbstate_t if it is too small.
163 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
164 implementing mbrtowc for encodings like UTF-8.
165 On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is
166 large enough and overriding it would cause problems in C++ mode. */
167 #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
168 # if !GNULIB_defined_mbstate_t
169 # if !(defined _AIX || defined _MSC_VER)
170 typedef int rpl_mbstate_t
;
172 # define mbstate_t rpl_mbstate_t
174 # define GNULIB_defined_mbstate_t 1
178 /* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
179 been included yet. */
180 #if @GNULIB_FREE_POSIX@
181 # if (@REPLACE_FREE@ && !defined free \
182 && !(defined __cplusplus && defined GNULIB_NAMESPACE))
183 /* We can't do '#define free rpl_free' here. */
184 _GL_EXTERN_C
void rpl_free (void *);
185 # undef _GL_ATTRIBUTE_DEALLOC_FREE
186 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
188 # if defined _MSC_VER
189 _GL_EXTERN_C
void __cdecl
free (void *);
191 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
192 _GL_EXTERN_C
void free (void *) throw ();
194 _GL_EXTERN_C
void free (void *);
199 # if defined _MSC_VER
200 _GL_EXTERN_C
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 /* Convert a single-byte character to a wide character. */
213 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
215 # define btowc rpl_btowc
217 _GL_FUNCDECL_RPL (btowc
, wint_t, (int c
) _GL_ATTRIBUTE_PURE
);
218 _GL_CXXALIAS_RPL (btowc
, wint_t, (int c
));
221 _GL_FUNCDECL_SYS (btowc
, wint_t, (int c
) _GL_ATTRIBUTE_PURE
);
223 /* Need to cast, because on mingw, the return type is 'unsigned short'. */
224 _GL_CXXALIAS_SYS_CAST (btowc
, wint_t, (int c
));
227 _GL_CXXALIASWARN (btowc
);
229 #elif defined GNULIB_POSIXCHECK
231 # if HAVE_RAW_DECL_BTOWC
232 _GL_WARN_ON_USE (btowc
, "btowc is unportable - "
233 "use gnulib module btowc for portability");
238 /* Convert a wide character to a single-byte character. */
241 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
243 # define wctob rpl_wctob
245 _GL_FUNCDECL_RPL (wctob
, int, (wint_t wc
) _GL_ATTRIBUTE_PURE
);
246 _GL_CXXALIAS_RPL (wctob
, int, (wint_t wc
));
248 # if !defined wctob && !@HAVE_DECL_WCTOB@
249 /* wctob is provided by gnulib, or wctob exists but is not declared. */
250 _GL_FUNCDECL_SYS (wctob
, int, (wint_t wc
) _GL_ATTRIBUTE_PURE
);
252 _GL_CXXALIAS_SYS (wctob
, int, (wint_t wc
));
255 _GL_CXXALIASWARN (wctob
);
257 #elif defined GNULIB_POSIXCHECK
259 # if HAVE_RAW_DECL_WCTOB
260 _GL_WARN_ON_USE (wctob
, "wctob is unportable - "
261 "use gnulib module wctob for portability");
266 /* Test whether *PS is in the initial state. */
268 # if @REPLACE_MBSINIT@
269 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
271 # define mbsinit rpl_mbsinit
273 _GL_FUNCDECL_RPL (mbsinit
, int, (const mbstate_t *ps
));
274 _GL_CXXALIAS_RPL (mbsinit
, int, (const mbstate_t *ps
));
277 _GL_FUNCDECL_SYS (mbsinit
, int, (const mbstate_t *ps
));
279 _GL_CXXALIAS_SYS (mbsinit
, int, (const mbstate_t *ps
));
282 _GL_CXXALIASWARN (mbsinit
);
284 #elif defined GNULIB_POSIXCHECK
286 # if HAVE_RAW_DECL_MBSINIT
287 _GL_WARN_ON_USE (mbsinit
, "mbsinit is unportable - "
288 "use gnulib module mbsinit for portability");
293 /* Convert a multibyte character to a wide character. */
295 # if @REPLACE_MBRTOWC@
296 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
298 # define mbrtowc rpl_mbrtowc
300 _GL_FUNCDECL_RPL (mbrtowc
, size_t,
301 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
,
302 mbstate_t *restrict ps
));
303 _GL_CXXALIAS_RPL (mbrtowc
, size_t,
304 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
,
305 mbstate_t *restrict ps
));
308 _GL_FUNCDECL_SYS (mbrtowc
, size_t,
309 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
,
310 mbstate_t *restrict ps
));
312 _GL_CXXALIAS_SYS (mbrtowc
, size_t,
313 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
,
314 mbstate_t *restrict ps
));
317 _GL_CXXALIASWARN (mbrtowc
);
319 #elif defined GNULIB_POSIXCHECK
321 # if HAVE_RAW_DECL_MBRTOWC
322 _GL_WARN_ON_USE (mbrtowc
, "mbrtowc is unportable - "
323 "use gnulib module mbrtowc for portability");
328 /* Recognize a multibyte character. */
330 # if @REPLACE_MBRLEN@
331 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
333 # define mbrlen rpl_mbrlen
335 _GL_FUNCDECL_RPL (mbrlen
, size_t,
336 (const char *restrict s
, size_t n
, mbstate_t *restrict ps
));
337 _GL_CXXALIAS_RPL (mbrlen
, size_t,
338 (const char *restrict s
, size_t n
, mbstate_t *restrict ps
));
341 _GL_FUNCDECL_SYS (mbrlen
, size_t,
342 (const char *restrict s
, size_t n
, mbstate_t *restrict ps
));
344 _GL_CXXALIAS_SYS (mbrlen
, size_t,
345 (const char *restrict s
, size_t n
, mbstate_t *restrict ps
));
348 _GL_CXXALIASWARN (mbrlen
);
350 #elif defined GNULIB_POSIXCHECK
352 # if HAVE_RAW_DECL_MBRLEN
353 _GL_WARN_ON_USE (mbrlen
, "mbrlen is unportable - "
354 "use gnulib module mbrlen for portability");
359 /* Convert a string to a wide string. */
360 #if @GNULIB_MBSRTOWCS@
361 # if @REPLACE_MBSRTOWCS@
362 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
364 # define mbsrtowcs rpl_mbsrtowcs
366 _GL_FUNCDECL_RPL (mbsrtowcs
, size_t,
367 (wchar_t *restrict dest
,
368 const char **restrict srcp
, size_t len
,
369 mbstate_t *restrict ps
)
370 _GL_ARG_NONNULL ((2)));
371 _GL_CXXALIAS_RPL (mbsrtowcs
, size_t,
372 (wchar_t *restrict dest
,
373 const char **restrict srcp
, size_t len
,
374 mbstate_t *restrict ps
));
376 # if !@HAVE_MBSRTOWCS@
377 _GL_FUNCDECL_SYS (mbsrtowcs
, size_t,
378 (wchar_t *restrict dest
,
379 const char **restrict srcp
, size_t len
,
380 mbstate_t *restrict ps
)
381 _GL_ARG_NONNULL ((2)));
383 _GL_CXXALIAS_SYS (mbsrtowcs
, size_t,
384 (wchar_t *restrict dest
,
385 const char **restrict srcp
, size_t len
,
386 mbstate_t *restrict ps
));
389 _GL_CXXALIASWARN (mbsrtowcs
);
391 #elif defined GNULIB_POSIXCHECK
393 # if HAVE_RAW_DECL_MBSRTOWCS
394 _GL_WARN_ON_USE (mbsrtowcs
, "mbsrtowcs is unportable - "
395 "use gnulib module mbsrtowcs for portability");
400 /* Convert a string to a wide string. */
401 #if @GNULIB_MBSNRTOWCS@
402 # if @REPLACE_MBSNRTOWCS@
403 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
405 # define mbsnrtowcs rpl_mbsnrtowcs
407 _GL_FUNCDECL_RPL (mbsnrtowcs
, size_t,
408 (wchar_t *restrict dest
,
409 const char **restrict srcp
, size_t srclen
, size_t len
,
410 mbstate_t *restrict ps
)
411 _GL_ARG_NONNULL ((2)));
412 _GL_CXXALIAS_RPL (mbsnrtowcs
, size_t,
413 (wchar_t *restrict dest
,
414 const char **restrict srcp
, size_t srclen
, size_t len
,
415 mbstate_t *restrict ps
));
417 # if !@HAVE_MBSNRTOWCS@
418 _GL_FUNCDECL_SYS (mbsnrtowcs
, size_t,
419 (wchar_t *restrict dest
,
420 const char **restrict srcp
, size_t srclen
, size_t len
,
421 mbstate_t *restrict ps
)
422 _GL_ARG_NONNULL ((2)));
424 _GL_CXXALIAS_SYS (mbsnrtowcs
, size_t,
425 (wchar_t *restrict dest
,
426 const char **restrict srcp
, size_t srclen
, size_t len
,
427 mbstate_t *restrict ps
));
429 _GL_CXXALIASWARN (mbsnrtowcs
);
430 #elif defined GNULIB_POSIXCHECK
432 # if HAVE_RAW_DECL_MBSNRTOWCS
433 _GL_WARN_ON_USE (mbsnrtowcs
, "mbsnrtowcs is unportable - "
434 "use gnulib module mbsnrtowcs for portability");
439 /* Convert a wide character to a multibyte character. */
441 # if @REPLACE_WCRTOMB@
442 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
444 # define wcrtomb rpl_wcrtomb
446 _GL_FUNCDECL_RPL (wcrtomb
, size_t,
447 (char *restrict s
, wchar_t wc
, mbstate_t *restrict ps
));
448 _GL_CXXALIAS_RPL (wcrtomb
, size_t,
449 (char *restrict s
, wchar_t wc
, mbstate_t *restrict ps
));
452 _GL_FUNCDECL_SYS (wcrtomb
, size_t,
453 (char *restrict s
, wchar_t wc
, mbstate_t *restrict ps
));
455 _GL_CXXALIAS_SYS (wcrtomb
, size_t,
456 (char *restrict s
, wchar_t wc
, mbstate_t *restrict ps
));
459 _GL_CXXALIASWARN (wcrtomb
);
461 #elif defined GNULIB_POSIXCHECK
463 # if HAVE_RAW_DECL_WCRTOMB
464 _GL_WARN_ON_USE (wcrtomb
, "wcrtomb is unportable - "
465 "use gnulib module wcrtomb for portability");
470 /* Convert a wide string to a string. */
471 #if @GNULIB_WCSRTOMBS@
472 # if @REPLACE_WCSRTOMBS@
473 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
475 # define wcsrtombs rpl_wcsrtombs
477 _GL_FUNCDECL_RPL (wcsrtombs
, size_t,
478 (char *restrict dest
, const wchar_t **restrict srcp
,
480 mbstate_t *restrict ps
)
481 _GL_ARG_NONNULL ((2)));
482 _GL_CXXALIAS_RPL (wcsrtombs
, size_t,
483 (char *restrict dest
, const wchar_t **restrict srcp
,
485 mbstate_t *restrict ps
));
487 # if !@HAVE_WCSRTOMBS@
488 _GL_FUNCDECL_SYS (wcsrtombs
, size_t,
489 (char *restrict dest
, const wchar_t **restrict srcp
,
491 mbstate_t *restrict ps
)
492 _GL_ARG_NONNULL ((2)));
494 _GL_CXXALIAS_SYS (wcsrtombs
, size_t,
495 (char *restrict dest
, const wchar_t **restrict srcp
,
497 mbstate_t *restrict ps
));
500 _GL_CXXALIASWARN (wcsrtombs
);
502 #elif defined GNULIB_POSIXCHECK
504 # if HAVE_RAW_DECL_WCSRTOMBS
505 _GL_WARN_ON_USE (wcsrtombs
, "wcsrtombs is unportable - "
506 "use gnulib module wcsrtombs for portability");
511 /* Convert a wide string to a string. */
512 #if @GNULIB_WCSNRTOMBS@
513 # if @REPLACE_WCSNRTOMBS@
514 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
516 # define wcsnrtombs rpl_wcsnrtombs
518 _GL_FUNCDECL_RPL (wcsnrtombs
, size_t,
519 (char *restrict dest
,
520 const wchar_t **restrict srcp
, size_t srclen
,
522 mbstate_t *restrict ps
)
523 _GL_ARG_NONNULL ((2)));
524 _GL_CXXALIAS_RPL (wcsnrtombs
, size_t,
525 (char *restrict dest
,
526 const wchar_t **restrict srcp
, size_t srclen
,
528 mbstate_t *restrict ps
));
530 # if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
531 _GL_FUNCDECL_SYS (wcsnrtombs
, size_t,
532 (char *restrict dest
,
533 const wchar_t **restrict srcp
, size_t srclen
,
535 mbstate_t *restrict ps
)
536 _GL_ARG_NONNULL ((2)));
538 _GL_CXXALIAS_SYS (wcsnrtombs
, size_t,
539 (char *restrict dest
,
540 const wchar_t **restrict srcp
, size_t srclen
,
542 mbstate_t *restrict ps
));
545 _GL_CXXALIASWARN (wcsnrtombs
);
547 #elif defined GNULIB_POSIXCHECK
549 # if HAVE_RAW_DECL_WCSNRTOMBS
550 _GL_WARN_ON_USE (wcsnrtombs
, "wcsnrtombs is unportable - "
551 "use gnulib module wcsnrtombs for portability");
556 /* Return the number of screen columns needed for WC. */
558 # if @REPLACE_WCWIDTH@
559 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
561 # define wcwidth rpl_wcwidth
563 _GL_FUNCDECL_RPL (wcwidth
, int, (wchar_t) _GL_ATTRIBUTE_PURE
);
564 _GL_CXXALIAS_RPL (wcwidth
, int, (wchar_t));
566 # if !@HAVE_DECL_WCWIDTH@
567 /* wcwidth exists but is not declared. */
568 _GL_FUNCDECL_SYS (wcwidth
, int, (wchar_t) _GL_ATTRIBUTE_PURE
);
570 _GL_CXXALIAS_SYS (wcwidth
, int, (wchar_t));
573 _GL_CXXALIASWARN (wcwidth
);
575 #elif defined GNULIB_POSIXCHECK
577 # if HAVE_RAW_DECL_WCWIDTH
578 _GL_WARN_ON_USE (wcwidth
, "wcwidth is unportable - "
579 "use gnulib module wcwidth for portability");
584 /* Search N wide characters of S for C. */
587 _GL_FUNCDECL_SYS (wmemchr
, wchar_t *, (const wchar_t *s
, wchar_t c
, size_t n
)
590 /* On some systems, this function is defined as an overloaded function:
592 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
593 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
595 _GL_CXXALIAS_SYS_CAST2 (wmemchr
,
596 wchar_t *, (const wchar_t *, wchar_t, size_t),
597 const wchar_t *, (const wchar_t *, wchar_t, size_t));
598 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
599 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
600 _GL_CXXALIASWARN1 (wmemchr
, wchar_t *, (wchar_t *s
, wchar_t c
, size_t n
));
601 _GL_CXXALIASWARN1 (wmemchr
, const wchar_t *,
602 (const wchar_t *s
, wchar_t c
, size_t n
));
603 # elif __GLIBC__ >= 2
604 _GL_CXXALIASWARN (wmemchr
);
606 #elif defined GNULIB_POSIXCHECK
608 # if HAVE_RAW_DECL_WMEMCHR
609 _GL_WARN_ON_USE (wmemchr
, "wmemchr is unportable - "
610 "use gnulib module wmemchr for portability");
615 /* Compare N wide characters of S1 and S2. */
618 _GL_FUNCDECL_SYS (wmemcmp
, int,
619 (const wchar_t *s1
, const wchar_t *s2
, size_t n
)
622 _GL_CXXALIAS_SYS (wmemcmp
, int,
623 (const wchar_t *s1
, const wchar_t *s2
, size_t n
));
625 _GL_CXXALIASWARN (wmemcmp
);
627 #elif defined GNULIB_POSIXCHECK
629 # if HAVE_RAW_DECL_WMEMCMP
630 _GL_WARN_ON_USE (wmemcmp
, "wmemcmp is unportable - "
631 "use gnulib module wmemcmp for portability");
636 /* Copy N wide characters of SRC to DEST. */
639 _GL_FUNCDECL_SYS (wmemcpy
, wchar_t *,
640 (wchar_t *restrict dest
,
641 const wchar_t *restrict src
, size_t n
));
643 _GL_CXXALIAS_SYS (wmemcpy
, wchar_t *,
644 (wchar_t *restrict dest
,
645 const wchar_t *restrict src
, size_t n
));
647 _GL_CXXALIASWARN (wmemcpy
);
649 #elif defined GNULIB_POSIXCHECK
651 # if HAVE_RAW_DECL_WMEMCPY
652 _GL_WARN_ON_USE (wmemcpy
, "wmemcpy is unportable - "
653 "use gnulib module wmemcpy for portability");
658 /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
659 overlapping memory areas. */
660 #if @GNULIB_WMEMMOVE@
661 # if !@HAVE_WMEMMOVE@
662 _GL_FUNCDECL_SYS (wmemmove
, wchar_t *,
663 (wchar_t *dest
, const wchar_t *src
, size_t n
));
665 _GL_CXXALIAS_SYS (wmemmove
, wchar_t *,
666 (wchar_t *dest
, const wchar_t *src
, size_t n
));
668 _GL_CXXALIASWARN (wmemmove
);
670 #elif defined GNULIB_POSIXCHECK
672 # if HAVE_RAW_DECL_WMEMMOVE
673 _GL_WARN_ON_USE (wmemmove
, "wmemmove is unportable - "
674 "use gnulib module wmemmove for portability");
679 /* Copy N wide characters of SRC to DEST.
680 Return pointer to wide characters after the last written wide character. */
681 #if @GNULIB_WMEMPCPY@
682 # if !@HAVE_WMEMPCPY@
683 _GL_FUNCDECL_SYS (wmempcpy
, wchar_t *,
684 (wchar_t *restrict dest
,
685 const wchar_t *restrict src
, size_t n
));
687 _GL_CXXALIAS_SYS (wmempcpy
, wchar_t *,
688 (wchar_t *restrict dest
,
689 const wchar_t *restrict src
, size_t n
));
691 _GL_CXXALIASWARN (wmempcpy
);
693 #elif defined GNULIB_POSIXCHECK
695 # if HAVE_RAW_DECL_WMEMPCPY
696 _GL_WARN_ON_USE (wmempcpy
, "wmempcpy is unportable - "
697 "use gnulib module wmempcpy for portability");
702 /* Set N wide characters of S to C. */
705 _GL_FUNCDECL_SYS (wmemset
, wchar_t *, (wchar_t *s
, wchar_t c
, size_t n
));
707 _GL_CXXALIAS_SYS (wmemset
, wchar_t *, (wchar_t *s
, wchar_t c
, size_t n
));
709 _GL_CXXALIASWARN (wmemset
);
711 #elif defined GNULIB_POSIXCHECK
713 # if HAVE_RAW_DECL_WMEMSET
714 _GL_WARN_ON_USE (wmemset
, "wmemset is unportable - "
715 "use gnulib module wmemset for portability");
720 /* Return the number of wide characters in S. */
723 _GL_FUNCDECL_SYS (wcslen
, size_t, (const wchar_t *s
) _GL_ATTRIBUTE_PURE
);
725 _GL_CXXALIAS_SYS (wcslen
, size_t, (const wchar_t *s
));
727 _GL_CXXALIASWARN (wcslen
);
729 #elif defined GNULIB_POSIXCHECK
731 # if HAVE_RAW_DECL_WCSLEN
732 _GL_WARN_ON_USE (wcslen
, "wcslen is unportable - "
733 "use gnulib module wcslen for portability");
738 /* Return the number of wide characters in S, but at most MAXLEN. */
741 _GL_FUNCDECL_SYS (wcsnlen
, size_t, (const wchar_t *s
, size_t maxlen
)
744 _GL_CXXALIAS_SYS (wcsnlen
, size_t, (const wchar_t *s
, size_t maxlen
));
745 _GL_CXXALIASWARN (wcsnlen
);
746 #elif defined GNULIB_POSIXCHECK
748 # if HAVE_RAW_DECL_WCSNLEN
749 _GL_WARN_ON_USE (wcsnlen
, "wcsnlen is unportable - "
750 "use gnulib module wcsnlen for portability");
755 /* Copy SRC to DEST. */
758 _GL_FUNCDECL_SYS (wcscpy
, wchar_t *,
759 (wchar_t *restrict dest
, const wchar_t *restrict src
));
761 _GL_CXXALIAS_SYS (wcscpy
, wchar_t *,
762 (wchar_t *restrict dest
, const wchar_t *restrict src
));
764 _GL_CXXALIASWARN (wcscpy
);
766 #elif defined GNULIB_POSIXCHECK
768 # if HAVE_RAW_DECL_WCSCPY
769 _GL_WARN_ON_USE (wcscpy
, "wcscpy is unportable - "
770 "use gnulib module wcscpy for portability");
775 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
778 _GL_FUNCDECL_SYS (wcpcpy
, wchar_t *,
779 (wchar_t *restrict dest
, const wchar_t *restrict src
));
781 _GL_CXXALIAS_SYS (wcpcpy
, wchar_t *,
782 (wchar_t *restrict dest
, const wchar_t *restrict src
));
783 _GL_CXXALIASWARN (wcpcpy
);
784 #elif defined GNULIB_POSIXCHECK
786 # if HAVE_RAW_DECL_WCPCPY
787 _GL_WARN_ON_USE (wcpcpy
, "wcpcpy is unportable - "
788 "use gnulib module wcpcpy for portability");
793 /* Copy no more than N wide characters of SRC to DEST. */
796 _GL_FUNCDECL_SYS (wcsncpy
, wchar_t *,
797 (wchar_t *restrict dest
,
798 const wchar_t *restrict src
, size_t n
));
800 _GL_CXXALIAS_SYS (wcsncpy
, wchar_t *,
801 (wchar_t *restrict dest
,
802 const wchar_t *restrict src
, size_t n
));
804 _GL_CXXALIASWARN (wcsncpy
);
806 #elif defined GNULIB_POSIXCHECK
808 # if HAVE_RAW_DECL_WCSNCPY
809 _GL_WARN_ON_USE (wcsncpy
, "wcsncpy is unportable - "
810 "use gnulib module wcsncpy for portability");
815 /* Copy no more than N characters of SRC to DEST, returning the address of
816 the last character written into DEST. */
819 _GL_FUNCDECL_SYS (wcpncpy
, wchar_t *,
820 (wchar_t *restrict dest
,
821 const wchar_t *restrict src
, size_t n
));
823 _GL_CXXALIAS_SYS (wcpncpy
, wchar_t *,
824 (wchar_t *restrict dest
,
825 const wchar_t *restrict src
, size_t n
));
826 _GL_CXXALIASWARN (wcpncpy
);
827 #elif defined GNULIB_POSIXCHECK
829 # if HAVE_RAW_DECL_WCPNCPY
830 _GL_WARN_ON_USE (wcpncpy
, "wcpncpy is unportable - "
831 "use gnulib module wcpncpy for portability");
836 /* Append SRC onto DEST. */
839 _GL_FUNCDECL_SYS (wcscat
, wchar_t *,
840 (wchar_t *restrict dest
, const wchar_t *restrict src
));
842 _GL_CXXALIAS_SYS (wcscat
, wchar_t *,
843 (wchar_t *restrict dest
, const wchar_t *restrict src
));
845 _GL_CXXALIASWARN (wcscat
);
847 #elif defined GNULIB_POSIXCHECK
849 # if HAVE_RAW_DECL_WCSCAT
850 _GL_WARN_ON_USE (wcscat
, "wcscat is unportable - "
851 "use gnulib module wcscat for portability");
856 /* Append no more than N wide characters of SRC onto DEST. */
859 _GL_FUNCDECL_SYS (wcsncat
, wchar_t *,
860 (wchar_t *restrict dest
, const wchar_t *restrict src
,
863 _GL_CXXALIAS_SYS (wcsncat
, wchar_t *,
864 (wchar_t *restrict dest
, const wchar_t *restrict src
,
867 _GL_CXXALIASWARN (wcsncat
);
869 #elif defined GNULIB_POSIXCHECK
871 # if HAVE_RAW_DECL_WCSNCAT
872 _GL_WARN_ON_USE (wcsncat
, "wcsncat is unportable - "
873 "use gnulib module wcsncat for portability");
878 /* Compare S1 and S2. */
881 _GL_FUNCDECL_SYS (wcscmp
, int, (const wchar_t *s1
, const wchar_t *s2
)
884 _GL_CXXALIAS_SYS (wcscmp
, int, (const wchar_t *s1
, const wchar_t *s2
));
886 _GL_CXXALIASWARN (wcscmp
);
888 #elif defined GNULIB_POSIXCHECK
890 # if HAVE_RAW_DECL_WCSCMP
891 _GL_WARN_ON_USE (wcscmp
, "wcscmp is unportable - "
892 "use gnulib module wcscmp for portability");
897 /* Compare no more than N wide characters of S1 and S2. */
900 _GL_FUNCDECL_SYS (wcsncmp
, int,
901 (const wchar_t *s1
, const wchar_t *s2
, size_t n
)
904 _GL_CXXALIAS_SYS (wcsncmp
, int,
905 (const wchar_t *s1
, const wchar_t *s2
, size_t n
));
907 _GL_CXXALIASWARN (wcsncmp
);
909 #elif defined GNULIB_POSIXCHECK
911 # if HAVE_RAW_DECL_WCSNCMP
912 _GL_WARN_ON_USE (wcsncmp
, "wcsncmp is unportable - "
913 "use gnulib module wcsncmp for portability");
918 /* Compare S1 and S2, ignoring case. */
919 #if @GNULIB_WCSCASECMP@
920 # if !@HAVE_WCSCASECMP@
921 _GL_FUNCDECL_SYS (wcscasecmp
, int, (const wchar_t *s1
, const wchar_t *s2
)
924 _GL_CXXALIAS_SYS (wcscasecmp
, int, (const wchar_t *s1
, const wchar_t *s2
));
925 _GL_CXXALIASWARN (wcscasecmp
);
926 #elif defined GNULIB_POSIXCHECK
928 # if HAVE_RAW_DECL_WCSCASECMP
929 _GL_WARN_ON_USE (wcscasecmp
, "wcscasecmp is unportable - "
930 "use gnulib module wcscasecmp for portability");
935 /* Compare no more than N chars of S1 and S2, ignoring case. */
936 #if @GNULIB_WCSNCASECMP@
937 # if !@HAVE_WCSNCASECMP@
938 _GL_FUNCDECL_SYS (wcsncasecmp
, int,
939 (const wchar_t *s1
, const wchar_t *s2
, size_t n
)
942 _GL_CXXALIAS_SYS (wcsncasecmp
, int,
943 (const wchar_t *s1
, const wchar_t *s2
, size_t n
));
944 _GL_CXXALIASWARN (wcsncasecmp
);
945 #elif defined GNULIB_POSIXCHECK
947 # if HAVE_RAW_DECL_WCSNCASECMP
948 _GL_WARN_ON_USE (wcsncasecmp
, "wcsncasecmp is unportable - "
949 "use gnulib module wcsncasecmp for portability");
954 /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
955 category of the current locale. */
958 _GL_FUNCDECL_SYS (wcscoll
, int, (const wchar_t *s1
, const wchar_t *s2
));
960 _GL_CXXALIAS_SYS (wcscoll
, int, (const wchar_t *s1
, const wchar_t *s2
));
962 _GL_CXXALIASWARN (wcscoll
);
964 #elif defined GNULIB_POSIXCHECK
966 # if HAVE_RAW_DECL_WCSCOLL
967 _GL_WARN_ON_USE (wcscoll
, "wcscoll is unportable - "
968 "use gnulib module wcscoll for portability");
973 /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
974 to two transformed strings the result is the as applying 'wcscoll' to the
978 _GL_FUNCDECL_SYS (wcsxfrm
, size_t,
979 (wchar_t *restrict s1
, const wchar_t *restrict s2
, size_t n
));
981 _GL_CXXALIAS_SYS (wcsxfrm
, size_t,
982 (wchar_t *restrict s1
, const wchar_t *restrict s2
, size_t n
));
984 _GL_CXXALIASWARN (wcsxfrm
);
986 #elif defined GNULIB_POSIXCHECK
988 # if HAVE_RAW_DECL_WCSXFRM
989 _GL_WARN_ON_USE (wcsxfrm
, "wcsxfrm is unportable - "
990 "use gnulib module wcsxfrm for portability");
995 /* Duplicate S, returning an identical malloc'd string. */
997 # if defined _WIN32 && !defined __CYGWIN__
998 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1000 # define wcsdup _wcsdup
1002 _GL_CXXALIAS_MDA (wcsdup
, wchar_t *, (const wchar_t *s
));
1004 # if !@HAVE_WCSDUP@ || __GNUC__ >= 11
1005 _GL_FUNCDECL_SYS (wcsdup
, wchar_t *,
1007 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
1009 _GL_CXXALIAS_SYS (wcsdup
, wchar_t *, (const wchar_t *s
));
1011 _GL_CXXALIASWARN (wcsdup
);
1013 # if __GNUC__ >= 11 && !defined wcsdup
1014 /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */
1015 _GL_FUNCDECL_SYS (wcsdup
, wchar_t *,
1017 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
1019 # if defined GNULIB_POSIXCHECK
1021 # if HAVE_RAW_DECL_WCSDUP
1022 _GL_WARN_ON_USE (wcsdup
, "wcsdup is unportable - "
1023 "use gnulib module wcsdup for portability");
1025 # elif @GNULIB_MDA_WCSDUP@
1026 /* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not
1027 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1028 platforms by defining GNULIB_NAMESPACE::wcsdup always. */
1029 # if defined _WIN32 && !defined __CYGWIN__
1030 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1032 # define wcsdup _wcsdup
1034 _GL_CXXALIAS_MDA (wcsdup
, wchar_t *, (const wchar_t *s
));
1036 _GL_FUNCDECL_SYS (wcsdup
, wchar_t *,
1038 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
);
1039 # if @HAVE_DECL_WCSDUP@
1040 _GL_CXXALIAS_SYS (wcsdup
, wchar_t *, (const wchar_t *s
));
1043 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
1044 _GL_CXXALIASWARN (wcsdup
);
1050 /* Find the first occurrence of WC in WCS. */
1053 _GL_FUNCDECL_SYS (wcschr
, wchar_t *, (const wchar_t *wcs
, wchar_t wc
)
1054 _GL_ATTRIBUTE_PURE
);
1056 /* On some systems, this function is defined as an overloaded function:
1058 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
1059 wchar_t * std::wcschr (wchar_t *, wchar_t);
1061 _GL_CXXALIAS_SYS_CAST2 (wcschr
,
1062 wchar_t *, (const wchar_t *, wchar_t),
1063 const wchar_t *, (const wchar_t *, wchar_t));
1064 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1065 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1066 _GL_CXXALIASWARN1 (wcschr
, wchar_t *, (wchar_t *wcs
, wchar_t wc
));
1067 _GL_CXXALIASWARN1 (wcschr
, const wchar_t *, (const wchar_t *wcs
, wchar_t wc
));
1068 # elif __GLIBC__ >= 2
1069 _GL_CXXALIASWARN (wcschr
);
1071 #elif defined GNULIB_POSIXCHECK
1073 # if HAVE_RAW_DECL_WCSCHR
1074 _GL_WARN_ON_USE (wcschr
, "wcschr is unportable - "
1075 "use gnulib module wcschr for portability");
1080 /* Find the last occurrence of WC in WCS. */
1081 #if @GNULIB_WCSRCHR@
1082 # if !@HAVE_WCSRCHR@
1083 _GL_FUNCDECL_SYS (wcsrchr
, wchar_t *, (const wchar_t *wcs
, wchar_t wc
)
1084 _GL_ATTRIBUTE_PURE
);
1086 /* On some systems, this function is defined as an overloaded function:
1088 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
1089 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
1091 _GL_CXXALIAS_SYS_CAST2 (wcsrchr
,
1092 wchar_t *, (const wchar_t *, wchar_t),
1093 const wchar_t *, (const wchar_t *, wchar_t));
1094 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1095 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1096 _GL_CXXALIASWARN1 (wcsrchr
, wchar_t *, (wchar_t *wcs
, wchar_t wc
));
1097 _GL_CXXALIASWARN1 (wcsrchr
, const wchar_t *, (const wchar_t *wcs
, wchar_t wc
));
1098 # elif __GLIBC__ >= 2
1099 _GL_CXXALIASWARN (wcsrchr
);
1101 #elif defined GNULIB_POSIXCHECK
1103 # if HAVE_RAW_DECL_WCSRCHR
1104 _GL_WARN_ON_USE (wcsrchr
, "wcsrchr is unportable - "
1105 "use gnulib module wcsrchr for portability");
1110 /* Return the length of the initial segmet of WCS which consists entirely
1111 of wide characters not in REJECT. */
1112 #if @GNULIB_WCSCSPN@
1113 # if !@HAVE_WCSCSPN@
1114 _GL_FUNCDECL_SYS (wcscspn
, size_t, (const wchar_t *wcs
, const wchar_t *reject
)
1115 _GL_ATTRIBUTE_PURE
);
1117 _GL_CXXALIAS_SYS (wcscspn
, size_t, (const wchar_t *wcs
, const wchar_t *reject
));
1119 _GL_CXXALIASWARN (wcscspn
);
1121 #elif defined GNULIB_POSIXCHECK
1123 # if HAVE_RAW_DECL_WCSCSPN
1124 _GL_WARN_ON_USE (wcscspn
, "wcscspn is unportable - "
1125 "use gnulib module wcscspn for portability");
1130 /* Return the length of the initial segmet of WCS which consists entirely
1131 of wide characters in ACCEPT. */
1134 _GL_FUNCDECL_SYS (wcsspn
, size_t, (const wchar_t *wcs
, const wchar_t *accept
)
1135 _GL_ATTRIBUTE_PURE
);
1137 _GL_CXXALIAS_SYS (wcsspn
, size_t, (const wchar_t *wcs
, const wchar_t *accept
));
1139 _GL_CXXALIASWARN (wcsspn
);
1141 #elif defined GNULIB_POSIXCHECK
1143 # if HAVE_RAW_DECL_WCSSPN
1144 _GL_WARN_ON_USE (wcsspn
, "wcsspn is unportable - "
1145 "use gnulib module wcsspn for portability");
1150 /* Find the first occurrence in WCS of any character in ACCEPT. */
1151 #if @GNULIB_WCSPBRK@
1152 # if !@HAVE_WCSPBRK@
1153 _GL_FUNCDECL_SYS (wcspbrk
, wchar_t *,
1154 (const wchar_t *wcs
, const wchar_t *accept
)
1155 _GL_ATTRIBUTE_PURE
);
1157 /* On some systems, this function is defined as an overloaded function:
1159 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
1160 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
1162 _GL_CXXALIAS_SYS_CAST2 (wcspbrk
,
1163 wchar_t *, (const wchar_t *, const wchar_t *),
1164 const wchar_t *, (const wchar_t *, const wchar_t *));
1165 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1166 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1167 _GL_CXXALIASWARN1 (wcspbrk
, wchar_t *,
1168 (wchar_t *wcs
, const wchar_t *accept
));
1169 _GL_CXXALIASWARN1 (wcspbrk
, const wchar_t *,
1170 (const wchar_t *wcs
, const wchar_t *accept
));
1171 # elif __GLIBC__ >= 2
1172 _GL_CXXALIASWARN (wcspbrk
);
1174 #elif defined GNULIB_POSIXCHECK
1176 # if HAVE_RAW_DECL_WCSPBRK
1177 _GL_WARN_ON_USE (wcspbrk
, "wcspbrk is unportable - "
1178 "use gnulib module wcspbrk for portability");
1183 /* Find the first occurrence of NEEDLE in HAYSTACK. */
1186 _GL_FUNCDECL_SYS (wcsstr
, wchar_t *,
1187 (const wchar_t *restrict haystack
,
1188 const wchar_t *restrict needle
)
1189 _GL_ATTRIBUTE_PURE
);
1191 /* On some systems, this function is defined as an overloaded function:
1193 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
1194 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
1196 _GL_CXXALIAS_SYS_CAST2 (wcsstr
,
1198 (const wchar_t *restrict
, const wchar_t *restrict
),
1200 (const wchar_t *restrict
, const wchar_t *restrict
));
1201 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1202 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1203 _GL_CXXALIASWARN1 (wcsstr
, wchar_t *,
1204 (wchar_t *restrict haystack
,
1205 const wchar_t *restrict needle
));
1206 _GL_CXXALIASWARN1 (wcsstr
, const wchar_t *,
1207 (const wchar_t *restrict haystack
,
1208 const wchar_t *restrict needle
));
1209 # elif __GLIBC__ >= 2
1210 _GL_CXXALIASWARN (wcsstr
);
1212 #elif defined GNULIB_POSIXCHECK
1214 # if HAVE_RAW_DECL_WCSSTR
1215 _GL_WARN_ON_USE (wcsstr
, "wcsstr is unportable - "
1216 "use gnulib module wcsstr for portability");
1221 /* Divide WCS into tokens separated by characters in DELIM. */
1223 # if @REPLACE_WCSTOK@
1224 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1226 # define wcstok rpl_wcstok
1228 _GL_FUNCDECL_RPL (wcstok
, wchar_t *,
1229 (wchar_t *restrict wcs
, const wchar_t *restrict delim
,
1230 wchar_t **restrict ptr
));
1231 _GL_CXXALIAS_RPL (wcstok
, wchar_t *,
1232 (wchar_t *restrict wcs
, const wchar_t *restrict delim
,
1233 wchar_t **restrict ptr
));
1236 _GL_FUNCDECL_SYS (wcstok
, wchar_t *,
1237 (wchar_t *restrict wcs
, const wchar_t *restrict delim
,
1238 wchar_t **restrict ptr
));
1240 _GL_CXXALIAS_SYS (wcstok
, wchar_t *,
1241 (wchar_t *restrict wcs
, const wchar_t *restrict delim
,
1242 wchar_t **restrict ptr
));
1245 _GL_CXXALIASWARN (wcstok
);
1247 #elif defined GNULIB_POSIXCHECK
1249 # if HAVE_RAW_DECL_WCSTOK
1250 _GL_WARN_ON_USE (wcstok
, "wcstok is unportable - "
1251 "use gnulib module wcstok for portability");
1256 /* Determine number of column positions required for first N wide
1257 characters (or fewer if S ends before this) in S. */
1258 #if @GNULIB_WCSWIDTH@
1259 # if @REPLACE_WCSWIDTH@
1260 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1262 # define wcswidth rpl_wcswidth
1264 _GL_FUNCDECL_RPL (wcswidth
, int, (const wchar_t *s
, size_t n
)
1265 _GL_ATTRIBUTE_PURE
);
1266 _GL_CXXALIAS_RPL (wcswidth
, int, (const wchar_t *s
, size_t n
));
1268 # if !@HAVE_WCSWIDTH@
1269 _GL_FUNCDECL_SYS (wcswidth
, int, (const wchar_t *s
, size_t n
)
1270 _GL_ATTRIBUTE_PURE
);
1272 _GL_CXXALIAS_SYS (wcswidth
, int, (const wchar_t *s
, size_t n
));
1275 _GL_CXXALIASWARN (wcswidth
);
1277 #elif defined GNULIB_POSIXCHECK
1279 # if HAVE_RAW_DECL_WCSWIDTH
1280 _GL_WARN_ON_USE (wcswidth
, "wcswidth is unportable - "
1281 "use gnulib module wcswidth for portability");
1286 /* Convert *TP to a date and time wide string. See
1287 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */
1288 #if @GNULIB_WCSFTIME@
1289 # if @REPLACE_WCSFTIME@
1290 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1292 # define wcsftime rpl_wcsftime
1294 _GL_FUNCDECL_RPL (wcsftime
, size_t,
1295 (wchar_t *restrict __buf
, size_t __bufsize
,
1296 const wchar_t *restrict __fmt
,
1297 const struct tm
*restrict __tp
)
1298 _GL_ARG_NONNULL ((1, 3, 4)));
1299 _GL_CXXALIAS_RPL (wcsftime
, size_t,
1300 (wchar_t *restrict __buf
, size_t __bufsize
,
1301 const wchar_t *restrict __fmt
,
1302 const struct tm
*restrict __tp
));
1304 # if !@HAVE_WCSFTIME@
1305 _GL_FUNCDECL_SYS (wcsftime
, size_t,
1306 (wchar_t *restrict __buf
, size_t __bufsize
,
1307 const wchar_t *restrict __fmt
,
1308 const struct tm
*restrict __tp
)
1309 _GL_ARG_NONNULL ((1, 3, 4)));
1311 _GL_CXXALIAS_SYS (wcsftime
, size_t,
1312 (wchar_t *restrict __buf
, size_t __bufsize
,
1313 const wchar_t *restrict __fmt
,
1314 const struct tm
*restrict __tp
));
1317 _GL_CXXALIASWARN (wcsftime
);
1319 #elif defined GNULIB_POSIXCHECK
1321 # if HAVE_RAW_DECL_WCSFTIME
1322 _GL_WARN_ON_USE (wcsftime
, "wcsftime is unportable - "
1323 "use gnulib module wcsftime for portability");
1328 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1329 #endif /* _@GUARD_PREFIX@_WCHAR_H */