Merge branch 'master' of github.com:monitoring-plugins/monitoring-plugins
[monitoring-plugins.git] / gl / wchar.in.h
blob09c9185f623f2af575a63de5d3c0f1b4f85ba480
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().
28 #if __GNUC__ >= 3
29 @PRAGMA_SYSTEM_HEADER@
30 #endif
31 @PRAGMA_COLUMNS@
33 #if (((defined __need_mbstate_t || defined __need_wint_t) \
34 && !defined __MINGW32__) \
35 || (defined __hpux \
36 && ((defined _INTTYPES_INCLUDED \
37 && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \
38 || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \
39 || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \
40 || defined _GL_ALREADY_INCLUDING_WCHAR_H)
41 /* Special invocation convention:
42 - Inside glibc and uClibc header files, but not MinGW.
43 - On HP-UX 11.00 we have a sequence of nested includes
44 <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
45 once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
46 and once directly. In both situations 'wint_t' is not yet defined,
47 therefore we cannot provide the function overrides; instead include only
48 the system's <wchar.h>.
49 - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of
50 <wchar.h> is actually processed, and that doesn't include 'mbstate_t'.
51 - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
52 the latter includes <wchar.h>. But here, we have no way to detect whether
53 <wctype.h> is completely included or is still being included. */
55 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
57 #else
58 /* Normal invocation convention. */
60 #ifndef _@GUARD_PREFIX@_WCHAR_H
62 #define _GL_ALREADY_INCLUDING_WCHAR_H
64 #if @HAVE_FEATURES_H@
65 # include <features.h> /* for __GLIBC__ */
66 #endif
68 /* In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
69 by <stddef.h>.
70 But avoid namespace pollution on glibc systems. */
71 #if !(defined __GLIBC__ && !defined __UCLIBC__)
72 # include <stddef.h>
73 #endif
75 /* Include the original <wchar.h> if it exists.
76 Some builds of uClibc lack it. */
77 /* The include_next requires a split double-inclusion guard. */
78 #if @HAVE_WCHAR_H@
79 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
80 #endif
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
89 function F. */
90 #ifndef _GL_ATTRIBUTE_DEALLOC
91 # if __GNUC__ >= 11
92 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
93 # else
94 # define _GL_ATTRIBUTE_DEALLOC(f, i)
95 # endif
96 #endif
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)
106 # else
107 # define _GL_ATTRIBUTE_DEALLOC_FREE \
108 _GL_ATTRIBUTE_DEALLOC (free, 1)
109 # endif
110 #endif
112 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
113 allocated memory. */
114 /* Applies to: functions. */
115 #ifndef _GL_ATTRIBUTE_MALLOC
116 # if __GNUC__ >= 3 || defined __clang__
117 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
118 # else
119 # define _GL_ATTRIBUTE_MALLOC
120 # endif
121 #endif
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__))
128 # else
129 # define _GL_ATTRIBUTE_PURE /* empty */
130 # endif
131 #endif
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
142 # define wint_t int
143 # ifndef WEOF
144 # define WEOF -1
145 # endif
146 #else
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>
154 # else
155 # include <stddef.h>
156 # endif
157 typedef unsigned int rpl_wint_t;
158 # undef wint_t
159 # define wint_t rpl_wint_t
160 # define GNULIB_defined_wint_t 1
161 # endif
162 # endif
163 # ifndef WEOF
164 # define WEOF ((wint_t) -1)
165 # endif
166 #endif
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;
178 # undef mbstate_t
179 # define mbstate_t rpl_mbstate_t
180 # endif
181 # define GNULIB_defined_mbstate_t 1
182 # endif
183 #endif
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)
194 # else
195 # if defined _MSC_VER && !defined free
196 _GL_EXTERN_C
197 # if defined _DLL
198 __declspec (dllimport)
199 # endif
200 void __cdecl free (void *);
201 # else
202 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
203 _GL_EXTERN_C void free (void *) throw ();
204 # else
205 _GL_EXTERN_C void free (void *);
206 # endif
207 # endif
208 # endif
209 #else
210 # if defined _MSC_VER && !defined free
211 _GL_EXTERN_C
212 # if defined _DLL
213 __declspec (dllimport)
214 # endif
215 void __cdecl free (void *);
216 # else
217 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
218 _GL_EXTERN_C void free (void *) throw ();
219 # else
220 _GL_EXTERN_C void free (void *);
221 # endif
222 # endif
223 #endif
225 /* Convert a single-byte character to a wide character. */
226 #if @GNULIB_BTOWC@
227 # if @REPLACE_BTOWC@
228 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
229 # undef btowc
230 # define btowc rpl_btowc
231 # endif
232 _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
233 _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
234 # else
235 # if !@HAVE_BTOWC@
236 _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
237 # endif
238 /* Need to cast, because on mingw, the return type is 'unsigned short'. */
239 _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
240 # endif
241 # if __GLIBC__ >= 2
242 _GL_CXXALIASWARN (btowc);
243 # endif
244 #elif defined GNULIB_POSIXCHECK
245 # undef btowc
246 # if HAVE_RAW_DECL_BTOWC
247 _GL_WARN_ON_USE (btowc, "btowc is unportable - "
248 "use gnulib module btowc for portability");
249 # endif
250 #endif
253 /* Convert a wide character to a single-byte character. */
254 #if @GNULIB_WCTOB@
255 # if @REPLACE_WCTOB@
256 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
257 # undef wctob
258 # define wctob rpl_wctob
259 # endif
260 _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
261 _GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
262 # else
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);
266 # endif
267 _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
268 # endif
269 # if __GLIBC__ >= 2
270 _GL_CXXALIASWARN (wctob);
271 # endif
272 #elif defined GNULIB_POSIXCHECK
273 # undef wctob
274 # if HAVE_RAW_DECL_WCTOB
275 _GL_WARN_ON_USE (wctob, "wctob is unportable - "
276 "use gnulib module wctob for portability");
277 # endif
278 #endif
281 /* Test whether *PS is in the initial state. */
282 #if @GNULIB_MBSINIT@
283 # if @REPLACE_MBSINIT@
284 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
285 # undef mbsinit
286 # define mbsinit rpl_mbsinit
287 # endif
288 _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
289 _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
290 # else
291 # if !@HAVE_MBSINIT@
292 _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
293 # endif
294 _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
295 # endif
296 # if __GLIBC__ >= 2
297 _GL_CXXALIASWARN (mbsinit);
298 # endif
299 #elif defined GNULIB_POSIXCHECK
300 # undef mbsinit
301 # if HAVE_RAW_DECL_MBSINIT
302 _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
303 "use gnulib module mbsinit for portability");
304 # endif
305 #endif
308 /* Convert a multibyte character to a wide character. */
309 #if @GNULIB_MBRTOWC@
310 # if @REPLACE_MBRTOWC@
311 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
312 # undef mbrtowc
313 # define mbrtowc rpl_mbrtowc
314 # endif
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));
321 # else
322 # if !@HAVE_MBRTOWC@
323 _GL_FUNCDECL_SYS (mbrtowc, size_t,
324 (wchar_t *restrict pwc, const char *restrict s, size_t n,
325 mbstate_t *restrict ps));
326 # endif
327 _GL_CXXALIAS_SYS (mbrtowc, size_t,
328 (wchar_t *restrict pwc, const char *restrict s, size_t n,
329 mbstate_t *restrict ps));
330 # endif
331 # if __GLIBC__ >= 2
332 _GL_CXXALIASWARN (mbrtowc);
333 # endif
334 #elif defined GNULIB_POSIXCHECK
335 # undef mbrtowc
336 # if HAVE_RAW_DECL_MBRTOWC
337 _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
338 "use gnulib module mbrtowc for portability");
339 # endif
340 #endif
343 /* Recognize a multibyte character. */
344 #if @GNULIB_MBRLEN@
345 # if @REPLACE_MBRLEN@
346 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
347 # undef mbrlen
348 # define mbrlen rpl_mbrlen
349 # endif
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));
354 # else
355 # if !@HAVE_MBRLEN@
356 _GL_FUNCDECL_SYS (mbrlen, size_t,
357 (const char *restrict s, size_t n, mbstate_t *restrict ps));
358 # endif
359 _GL_CXXALIAS_SYS (mbrlen, size_t,
360 (const char *restrict s, size_t n, mbstate_t *restrict ps));
361 # endif
362 # if __GLIBC__ >= 2
363 _GL_CXXALIASWARN (mbrlen);
364 # endif
365 #elif defined GNULIB_POSIXCHECK
366 # undef mbrlen
367 # if HAVE_RAW_DECL_MBRLEN
368 _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
369 "use gnulib module mbrlen for portability");
370 # endif
371 #endif
374 /* Convert a string to a wide string. */
375 #if @GNULIB_MBSRTOWCS@
376 # if @REPLACE_MBSRTOWCS@
377 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
378 # undef mbsrtowcs
379 # define mbsrtowcs rpl_mbsrtowcs
380 # endif
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));
390 # else
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)));
397 # endif
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));
402 # endif
403 # if __GLIBC__ >= 2
404 _GL_CXXALIASWARN (mbsrtowcs);
405 # endif
406 #elif defined GNULIB_POSIXCHECK
407 # undef mbsrtowcs
408 # if HAVE_RAW_DECL_MBSRTOWCS
409 _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
410 "use gnulib module mbsrtowcs for portability");
411 # endif
412 #endif
415 /* Convert a string to a wide string. */
416 #if @GNULIB_MBSNRTOWCS@
417 # if @REPLACE_MBSNRTOWCS@
418 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
419 # undef mbsnrtowcs
420 # define mbsnrtowcs rpl_mbsnrtowcs
421 # endif
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));
431 # else
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)));
438 # endif
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));
443 # endif
444 _GL_CXXALIASWARN (mbsnrtowcs);
445 #elif defined GNULIB_POSIXCHECK
446 # undef mbsnrtowcs
447 # if HAVE_RAW_DECL_MBSNRTOWCS
448 _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
449 "use gnulib module mbsnrtowcs for portability");
450 # endif
451 #endif
454 /* Convert a wide character to a multibyte character. */
455 #if @GNULIB_WCRTOMB@
456 # if @REPLACE_WCRTOMB@
457 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
458 # undef wcrtomb
459 # define wcrtomb rpl_wcrtomb
460 # endif
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));
465 # else
466 # if !@HAVE_WCRTOMB@
467 _GL_FUNCDECL_SYS (wcrtomb, size_t,
468 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
469 # endif
470 _GL_CXXALIAS_SYS (wcrtomb, size_t,
471 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
472 # endif
473 # if __GLIBC__ >= 2
474 _GL_CXXALIASWARN (wcrtomb);
475 # endif
476 #elif defined GNULIB_POSIXCHECK
477 # undef wcrtomb
478 # if HAVE_RAW_DECL_WCRTOMB
479 _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
480 "use gnulib module wcrtomb for portability");
481 # endif
482 #endif
485 /* Convert a wide string to a string. */
486 #if @GNULIB_WCSRTOMBS@
487 # if @REPLACE_WCSRTOMBS@
488 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
489 # undef wcsrtombs
490 # define wcsrtombs rpl_wcsrtombs
491 # endif
492 _GL_FUNCDECL_RPL (wcsrtombs, size_t,
493 (char *restrict dest, const wchar_t **restrict srcp,
494 size_t len,
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,
499 size_t len,
500 mbstate_t *restrict ps));
501 # else
502 # if !@HAVE_WCSRTOMBS@
503 _GL_FUNCDECL_SYS (wcsrtombs, size_t,
504 (char *restrict dest, const wchar_t **restrict srcp,
505 size_t len,
506 mbstate_t *restrict ps)
507 _GL_ARG_NONNULL ((2)));
508 # endif
509 _GL_CXXALIAS_SYS (wcsrtombs, size_t,
510 (char *restrict dest, const wchar_t **restrict srcp,
511 size_t len,
512 mbstate_t *restrict ps));
513 # endif
514 # if __GLIBC__ >= 2
515 _GL_CXXALIASWARN (wcsrtombs);
516 # endif
517 #elif defined GNULIB_POSIXCHECK
518 # undef wcsrtombs
519 # if HAVE_RAW_DECL_WCSRTOMBS
520 _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
521 "use gnulib module wcsrtombs for portability");
522 # endif
523 #endif
526 /* Convert a wide string to a string. */
527 #if @GNULIB_WCSNRTOMBS@
528 # if @REPLACE_WCSNRTOMBS@
529 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
530 # undef wcsnrtombs
531 # define wcsnrtombs rpl_wcsnrtombs
532 # endif
533 _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
534 (char *restrict dest,
535 const wchar_t **restrict srcp, size_t srclen,
536 size_t len,
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,
542 size_t len,
543 mbstate_t *restrict ps));
544 # else
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,
549 size_t len,
550 mbstate_t *restrict ps)
551 _GL_ARG_NONNULL ((2)));
552 # endif
553 _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
554 (char *restrict dest,
555 const wchar_t **restrict srcp, size_t srclen,
556 size_t len,
557 mbstate_t *restrict ps));
558 # endif
559 # if __GLIBC__ >= 2
560 _GL_CXXALIASWARN (wcsnrtombs);
561 # endif
562 #elif defined GNULIB_POSIXCHECK
563 # undef wcsnrtombs
564 # if HAVE_RAW_DECL_WCSNRTOMBS
565 _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
566 "use gnulib module wcsnrtombs for portability");
567 # endif
568 #endif
571 /* Return the number of screen columns needed for WC. */
572 #if @GNULIB_WCWIDTH@
573 # if @REPLACE_WCWIDTH@
574 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
575 # undef wcwidth
576 # define wcwidth rpl_wcwidth
577 # endif
578 _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
579 _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
580 # else
581 # if !@HAVE_DECL_WCWIDTH@
582 /* wcwidth exists but is not declared. */
583 _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
584 # endif
585 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
586 # endif
587 # if __GLIBC__ >= 2
588 _GL_CXXALIASWARN (wcwidth);
589 # endif
590 #elif defined GNULIB_POSIXCHECK
591 # undef wcwidth
592 # if HAVE_RAW_DECL_WCWIDTH
593 _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
594 "use gnulib module wcwidth for portability");
595 # endif
596 #endif
599 /* Search N wide characters of S for C. */
600 #if @GNULIB_WMEMCHR@
601 # if !@HAVE_WMEMCHR@
602 _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
603 _GL_ATTRIBUTE_PURE);
604 # endif
605 /* On some systems, this function is defined as an overloaded function:
606 extern "C++" {
607 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
608 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
609 } */
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);
620 # endif
621 #elif defined GNULIB_POSIXCHECK
622 # undef wmemchr
623 # if HAVE_RAW_DECL_WMEMCHR
624 _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
625 "use gnulib module wmemchr for portability");
626 # endif
627 #endif
630 /* Compare N wide characters of S1 and S2. */
631 #if @GNULIB_WMEMCMP@
632 # if !@HAVE_WMEMCMP@
633 _GL_FUNCDECL_SYS (wmemcmp, int,
634 (const wchar_t *s1, const wchar_t *s2, size_t n)
635 _GL_ATTRIBUTE_PURE);
636 # endif
637 _GL_CXXALIAS_SYS (wmemcmp, int,
638 (const wchar_t *s1, const wchar_t *s2, size_t n));
639 # if __GLIBC__ >= 2
640 _GL_CXXALIASWARN (wmemcmp);
641 # endif
642 #elif defined GNULIB_POSIXCHECK
643 # undef wmemcmp
644 # if HAVE_RAW_DECL_WMEMCMP
645 _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
646 "use gnulib module wmemcmp for portability");
647 # endif
648 #endif
651 /* Copy N wide characters of SRC to DEST. */
652 #if @GNULIB_WMEMCPY@
653 # if !@HAVE_WMEMCPY@
654 _GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
655 (wchar_t *restrict dest,
656 const wchar_t *restrict src, size_t n));
657 # endif
658 _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
659 (wchar_t *restrict dest,
660 const wchar_t *restrict src, size_t n));
661 # if __GLIBC__ >= 2
662 _GL_CXXALIASWARN (wmemcpy);
663 # endif
664 #elif defined GNULIB_POSIXCHECK
665 # undef wmemcpy
666 # if HAVE_RAW_DECL_WMEMCPY
667 _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
668 "use gnulib module wmemcpy for portability");
669 # endif
670 #endif
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));
679 # endif
680 _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
681 (wchar_t *dest, const wchar_t *src, size_t n));
682 # if __GLIBC__ >= 2
683 _GL_CXXALIASWARN (wmemmove);
684 # endif
685 #elif defined GNULIB_POSIXCHECK
686 # undef wmemmove
687 # if HAVE_RAW_DECL_WMEMMOVE
688 _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
689 "use gnulib module wmemmove for portability");
690 # endif
691 #endif
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));
701 # endif
702 _GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
703 (wchar_t *restrict dest,
704 const wchar_t *restrict src, size_t n));
705 # if __GLIBC__ >= 2
706 _GL_CXXALIASWARN (wmempcpy);
707 # endif
708 #elif defined GNULIB_POSIXCHECK
709 # undef wmempcpy
710 # if HAVE_RAW_DECL_WMEMPCPY
711 _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
712 "use gnulib module wmempcpy for portability");
713 # endif
714 #endif
717 /* Set N wide characters of S to C. */
718 #if @GNULIB_WMEMSET@
719 # if !@HAVE_WMEMSET@
720 _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
721 # endif
722 _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
723 # if __GLIBC__ >= 2
724 _GL_CXXALIASWARN (wmemset);
725 # endif
726 #elif defined GNULIB_POSIXCHECK
727 # undef wmemset
728 # if HAVE_RAW_DECL_WMEMSET
729 _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
730 "use gnulib module wmemset for portability");
731 # endif
732 #endif
735 /* Return the number of wide characters in S. */
736 #if @GNULIB_WCSLEN@
737 # if !@HAVE_WCSLEN@
738 _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
739 # endif
740 _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
741 # if __GLIBC__ >= 2
742 _GL_CXXALIASWARN (wcslen);
743 # endif
744 #elif defined GNULIB_POSIXCHECK
745 # undef wcslen
746 # if HAVE_RAW_DECL_WCSLEN
747 _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
748 "use gnulib module wcslen for portability");
749 # endif
750 #endif
753 /* Return the number of wide characters in S, but at most MAXLEN. */
754 #if @GNULIB_WCSNLEN@
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)
760 _GL_ATTRIBUTE_PURE);
761 # endif
762 _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
763 _GL_CXXALIASWARN (wcsnlen);
764 #elif defined GNULIB_POSIXCHECK
765 # undef wcsnlen
766 # if HAVE_RAW_DECL_WCSNLEN
767 _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
768 "use gnulib module wcsnlen for portability");
769 # endif
770 #endif
773 /* Copy SRC to DEST. */
774 #if @GNULIB_WCSCPY@
775 # if !@HAVE_WCSCPY@
776 _GL_FUNCDECL_SYS (wcscpy, wchar_t *,
777 (wchar_t *restrict dest, const wchar_t *restrict src));
778 # endif
779 _GL_CXXALIAS_SYS (wcscpy, wchar_t *,
780 (wchar_t *restrict dest, const wchar_t *restrict src));
781 # if __GLIBC__ >= 2
782 _GL_CXXALIASWARN (wcscpy);
783 # endif
784 #elif defined GNULIB_POSIXCHECK
785 # undef wcscpy
786 # if HAVE_RAW_DECL_WCSCPY
787 _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
788 "use gnulib module wcscpy for portability");
789 # endif
790 #endif
793 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
794 #if @GNULIB_WCPCPY@
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));
801 # endif
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
806 # undef wcpcpy
807 # if HAVE_RAW_DECL_WCPCPY
808 _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
809 "use gnulib module wcpcpy for portability");
810 # endif
811 #endif
814 /* Copy no more than N wide characters of SRC to DEST. */
815 #if @GNULIB_WCSNCPY@
816 # if !@HAVE_WCSNCPY@
817 _GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
818 (wchar_t *restrict dest,
819 const wchar_t *restrict src, size_t n));
820 # endif
821 _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
822 (wchar_t *restrict dest,
823 const wchar_t *restrict src, size_t n));
824 # if __GLIBC__ >= 2
825 _GL_CXXALIASWARN (wcsncpy);
826 # endif
827 #elif defined GNULIB_POSIXCHECK
828 # undef wcsncpy
829 # if HAVE_RAW_DECL_WCSNCPY
830 _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
831 "use gnulib module wcsncpy for portability");
832 # endif
833 #endif
836 /* Copy no more than N characters of SRC to DEST, returning the address of
837 the last character written into DEST. */
838 #if @GNULIB_WCPNCPY@
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));
846 # endif
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
852 # undef wcpncpy
853 # if HAVE_RAW_DECL_WCPNCPY
854 _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
855 "use gnulib module wcpncpy for portability");
856 # endif
857 #endif
860 /* Append SRC onto DEST. */
861 #if @GNULIB_WCSCAT@
862 # if !@HAVE_WCSCAT@
863 _GL_FUNCDECL_SYS (wcscat, wchar_t *,
864 (wchar_t *restrict dest, const wchar_t *restrict src));
865 # endif
866 _GL_CXXALIAS_SYS (wcscat, wchar_t *,
867 (wchar_t *restrict dest, const wchar_t *restrict src));
868 # if __GLIBC__ >= 2
869 _GL_CXXALIASWARN (wcscat);
870 # endif
871 #elif defined GNULIB_POSIXCHECK
872 # undef wcscat
873 # if HAVE_RAW_DECL_WCSCAT
874 _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
875 "use gnulib module wcscat for portability");
876 # endif
877 #endif
880 /* Append no more than N wide characters of SRC onto DEST. */
881 #if @GNULIB_WCSNCAT@
882 # if !@HAVE_WCSNCAT@
883 _GL_FUNCDECL_SYS (wcsncat, wchar_t *,
884 (wchar_t *restrict dest, const wchar_t *restrict src,
885 size_t n));
886 # endif
887 _GL_CXXALIAS_SYS (wcsncat, wchar_t *,
888 (wchar_t *restrict dest, const wchar_t *restrict src,
889 size_t n));
890 # if __GLIBC__ >= 2
891 _GL_CXXALIASWARN (wcsncat);
892 # endif
893 #elif defined GNULIB_POSIXCHECK
894 # undef wcsncat
895 # if HAVE_RAW_DECL_WCSNCAT
896 _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
897 "use gnulib module wcsncat for portability");
898 # endif
899 #endif
902 /* Compare S1 and S2. */
903 #if @GNULIB_WCSCMP@
904 # if !@HAVE_WCSCMP@
905 _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
906 _GL_ATTRIBUTE_PURE);
907 # endif
908 _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
909 # if __GLIBC__ >= 2
910 _GL_CXXALIASWARN (wcscmp);
911 # endif
912 #elif defined GNULIB_POSIXCHECK
913 # undef wcscmp
914 # if HAVE_RAW_DECL_WCSCMP
915 _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
916 "use gnulib module wcscmp for portability");
917 # endif
918 #endif
921 /* Compare no more than N wide characters of S1 and S2. */
922 #if @GNULIB_WCSNCMP@
923 # if !@HAVE_WCSNCMP@
924 _GL_FUNCDECL_SYS (wcsncmp, int,
925 (const wchar_t *s1, const wchar_t *s2, size_t n)
926 _GL_ATTRIBUTE_PURE);
927 # endif
928 _GL_CXXALIAS_SYS (wcsncmp, int,
929 (const wchar_t *s1, const wchar_t *s2, size_t n));
930 # if __GLIBC__ >= 2
931 _GL_CXXALIASWARN (wcsncmp);
932 # endif
933 #elif defined GNULIB_POSIXCHECK
934 # undef wcsncmp
935 # if HAVE_RAW_DECL_WCSNCMP
936 _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
937 "use gnulib module wcsncmp for portability");
938 # endif
939 #endif
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)
949 _GL_ATTRIBUTE_PURE);
950 # endif
951 _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
952 _GL_CXXALIASWARN (wcscasecmp);
953 #elif defined GNULIB_POSIXCHECK
954 # undef wcscasecmp
955 # if HAVE_RAW_DECL_WCSCASECMP
956 _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
957 "use gnulib module wcscasecmp for portability");
958 # endif
959 #endif
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)
970 _GL_ATTRIBUTE_PURE);
971 # endif
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
976 # undef wcsncasecmp
977 # if HAVE_RAW_DECL_WCSNCASECMP
978 _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
979 "use gnulib module wcsncasecmp for portability");
980 # endif
981 #endif
984 /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
985 category of the current locale. */
986 #if @GNULIB_WCSCOLL@
987 # if !@HAVE_WCSCOLL@
988 _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
989 # endif
990 _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
991 # if __GLIBC__ >= 2
992 _GL_CXXALIASWARN (wcscoll);
993 # endif
994 #elif defined GNULIB_POSIXCHECK
995 # undef wcscoll
996 # if HAVE_RAW_DECL_WCSCOLL
997 _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
998 "use gnulib module wcscoll for portability");
999 # endif
1000 #endif
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));
1010 # endif
1011 _GL_CXXALIAS_SYS (wcsxfrm, size_t,
1012 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
1013 # if __GLIBC__ >= 2
1014 _GL_CXXALIASWARN (wcsxfrm);
1015 # endif
1016 #elif defined GNULIB_POSIXCHECK
1017 # undef wcsxfrm
1018 # if HAVE_RAW_DECL_WCSXFRM
1019 _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
1020 "use gnulib module wcsxfrm for portability");
1021 # endif
1022 #endif
1025 /* Duplicate S, returning an identical malloc'd string. */
1026 #if @GNULIB_WCSDUP@
1027 # if defined _WIN32 && !defined __CYGWIN__
1028 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1029 # undef wcsdup
1030 # define wcsdup _wcsdup
1031 # endif
1032 _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1033 # else
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 *,
1039 (const wchar_t *s)
1040 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1041 # endif
1042 _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1043 # endif
1044 _GL_CXXALIASWARN (wcsdup);
1045 #else
1046 # if __GNUC__ >= 11 && !defined wcsdup
1047 /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */
1048 _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1049 (const wchar_t *s)
1050 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1051 # endif
1052 # if defined GNULIB_POSIXCHECK
1053 # undef wcsdup
1054 # if HAVE_RAW_DECL_WCSDUP
1055 _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
1056 "use gnulib module wcsdup for portability");
1057 # endif
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)
1064 # undef wcsdup
1065 # define wcsdup _wcsdup
1066 # endif
1067 _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1068 # else
1069 _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1070 (const wchar_t *s)
1071 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1072 # if @HAVE_DECL_WCSDUP@
1073 _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1074 # endif
1075 # endif
1076 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
1077 _GL_CXXALIASWARN (wcsdup);
1078 # endif
1079 # endif
1080 #endif
1083 /* Find the first occurrence of WC in WCS. */
1084 #if @GNULIB_WCSCHR@
1085 # if !@HAVE_WCSCHR@
1086 _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
1087 _GL_ATTRIBUTE_PURE);
1088 # endif
1089 /* On some systems, this function is defined as an overloaded function:
1090 extern "C++" {
1091 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
1092 wchar_t * std::wcschr (wchar_t *, wchar_t);
1093 } */
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);
1103 # endif
1104 #elif defined GNULIB_POSIXCHECK
1105 # undef wcschr
1106 # if HAVE_RAW_DECL_WCSCHR
1107 _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
1108 "use gnulib module wcschr for portability");
1109 # endif
1110 #endif
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);
1118 # endif
1119 /* On some systems, this function is defined as an overloaded function:
1120 extern "C++" {
1121 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
1122 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
1123 } */
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);
1133 # endif
1134 #elif defined GNULIB_POSIXCHECK
1135 # undef wcsrchr
1136 # if HAVE_RAW_DECL_WCSRCHR
1137 _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
1138 "use gnulib module wcsrchr for portability");
1139 # endif
1140 #endif
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);
1149 # endif
1150 _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
1151 # if __GLIBC__ >= 2
1152 _GL_CXXALIASWARN (wcscspn);
1153 # endif
1154 #elif defined GNULIB_POSIXCHECK
1155 # undef wcscspn
1156 # if HAVE_RAW_DECL_WCSCSPN
1157 _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
1158 "use gnulib module wcscspn for portability");
1159 # endif
1160 #endif
1163 /* Return the length of the initial segmet of WCS which consists entirely
1164 of wide characters in ACCEPT. */
1165 #if @GNULIB_WCSSPN@
1166 # if !@HAVE_WCSSPN@
1167 _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
1168 _GL_ATTRIBUTE_PURE);
1169 # endif
1170 _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
1171 # if __GLIBC__ >= 2
1172 _GL_CXXALIASWARN (wcsspn);
1173 # endif
1174 #elif defined GNULIB_POSIXCHECK
1175 # undef wcsspn
1176 # if HAVE_RAW_DECL_WCSSPN
1177 _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
1178 "use gnulib module wcsspn for portability");
1179 # endif
1180 #endif
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);
1189 # endif
1190 /* On some systems, this function is defined as an overloaded function:
1191 extern "C++" {
1192 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
1193 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
1194 } */
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);
1206 # endif
1207 #elif defined GNULIB_POSIXCHECK
1208 # undef wcspbrk
1209 # if HAVE_RAW_DECL_WCSPBRK
1210 _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
1211 "use gnulib module wcspbrk for portability");
1212 # endif
1213 #endif
1216 /* Find the first occurrence of NEEDLE in HAYSTACK. */
1217 #if @GNULIB_WCSSTR@
1218 # if !@HAVE_WCSSTR@
1219 _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
1220 (const wchar_t *restrict haystack,
1221 const wchar_t *restrict needle)
1222 _GL_ATTRIBUTE_PURE);
1223 # endif
1224 /* On some systems, this function is defined as an overloaded function:
1225 extern "C++" {
1226 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
1227 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
1228 } */
1229 _GL_CXXALIAS_SYS_CAST2 (wcsstr,
1230 wchar_t *,
1231 (const wchar_t *restrict, const wchar_t *restrict),
1232 const wchar_t *,
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);
1244 # endif
1245 #elif defined GNULIB_POSIXCHECK
1246 # undef wcsstr
1247 # if HAVE_RAW_DECL_WCSSTR
1248 _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
1249 "use gnulib module wcsstr for portability");
1250 # endif
1251 #endif
1254 /* Divide WCS into tokens separated by characters in DELIM. */
1255 #if @GNULIB_WCSTOK@
1256 # if @REPLACE_WCSTOK@
1257 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1258 # undef wcstok
1259 # define wcstok rpl_wcstok
1260 # endif
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));
1267 # else
1268 # if !@HAVE_WCSTOK@
1269 _GL_FUNCDECL_SYS (wcstok, wchar_t *,
1270 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1271 wchar_t **restrict ptr));
1272 # endif
1273 _GL_CXXALIAS_SYS (wcstok, wchar_t *,
1274 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1275 wchar_t **restrict ptr));
1276 # endif
1277 # if __GLIBC__ >= 2
1278 _GL_CXXALIASWARN (wcstok);
1279 # endif
1280 #elif defined GNULIB_POSIXCHECK
1281 # undef wcstok
1282 # if HAVE_RAW_DECL_WCSTOK
1283 _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
1284 "use gnulib module wcstok for portability");
1285 # endif
1286 #endif
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)
1294 # undef wcswidth
1295 # define wcswidth rpl_wcswidth
1296 # endif
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));
1300 # else
1301 # if !@HAVE_WCSWIDTH@
1302 _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
1303 _GL_ATTRIBUTE_PURE);
1304 # endif
1305 _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1306 # endif
1307 # if __GLIBC__ >= 2
1308 _GL_CXXALIASWARN (wcswidth);
1309 # endif
1310 #elif defined GNULIB_POSIXCHECK
1311 # undef wcswidth
1312 # if HAVE_RAW_DECL_WCSWIDTH
1313 _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1314 "use gnulib module wcswidth for portability");
1315 # endif
1316 #endif
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)
1324 # undef wcsftime
1325 # define wcsftime rpl_wcsftime
1326 # endif
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));
1336 # else
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)));
1343 # endif
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));
1348 # endif
1349 # if __GLIBC__ >= 2
1350 _GL_CXXALIASWARN (wcsftime);
1351 # endif
1352 #elif defined GNULIB_POSIXCHECK
1353 # undef wcsftime
1354 # if HAVE_RAW_DECL_WCSFTIME
1355 _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
1356 "use gnulib module wcsftime for portability");
1357 # endif
1358 #endif
1361 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1362 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1363 #endif