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