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