Debian Codegraph @

lib/wchar.in.h

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