test-readtokens.c: avoid const-related compilation warnings
[gnulib.git] / lib / wchar.in.h
1 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
2
3    Copyright (C) 2007-2012 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program 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 General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
17
18 /* Written by Eric Blake.  */
19
20 /*
21  * ISO C 99 <wchar.h> for platforms that have issues.
22  * <http://www.opengroup.org/susv3xbd/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 || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
34 /* Special invocation convention:
35    - Inside glibc and uClibc header files.
36    - On HP-UX 11.00 we have a sequence of nested includes
37      <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
38      once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
39      and once directly.  In both situations 'wint_t' is not yet defined,
40      therefore we cannot provide the function overrides; instead include only
41      the system's <wchar.h>.
42    - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
43      the latter includes <wchar.h>.  But here, we have no way to detect whether
44      <wctype.h> is completely included or is still being included.  */
45
46 #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
47
48 #else
49 /* Normal invocation convention.  */
50
51 #ifndef _@GUARD_PREFIX@_WCHAR_H
52
53 #define _GL_ALREADY_INCLUDING_WCHAR_H
54
55 #if @HAVE_FEATURES_H@
56 # include <features.h> /* for __GLIBC__ */
57 #endif
58
59 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
60    <wchar.h>.
61    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
62    included before <wchar.h>.
63    In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
64    by <stddef.h>.
65    But avoid namespace pollution on glibc systems.  */
66 #if !(defined __GLIBC__ && !defined __UCLIBC__)
67 # include <stddef.h>
68 #endif
69 #ifndef __GLIBC__
70 # include <stdio.h>
71 # include <time.h>
72 #endif
73
74 /* Include the original <wchar.h> if it exists.
75    Some builds of uClibc lack it.  */
76 /* The include_next requires a split double-inclusion guard.  */
77 #if @HAVE_WCHAR_H@
78 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
79 #endif
80
81 #undef _GL_ALREADY_INCLUDING_WCHAR_H
82
83 #ifndef _@GUARD_PREFIX@_WCHAR_H
84 #define _@GUARD_PREFIX@_WCHAR_H
85
86 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
87
88 /* The definition of _GL_ARG_NONNULL is copied here.  */
89
90 /* The definition of _GL_WARN_ON_USE is copied here.  */
91
92
93 /* Define wint_t and WEOF.  (Also done in wctype.in.h.)  */
94 #if !@HAVE_WINT_T@ && !defined wint_t
95 # define wint_t int
96 # ifndef WEOF
97 #  define WEOF -1
98 # endif
99 #else
100 /* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
101    This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
102    "unchanged by default argument promotions".  Override it.  */
103 # if defined _MSC_VER
104 #  if !GNULIB_defined_wint_t
105 #   include <crtdefs.h>
106 typedef unsigned int rpl_wint_t;
107 #   undef wint_t
108 #   define wint_t rpl_wint_t
109 #   define GNULIB_defined_wint_t 1
110 #  endif
111 # endif
112 # ifndef WEOF
113 #  define WEOF ((wint_t) -1)
114 # endif
115 #endif
116
117
118 /* Override mbstate_t if it is too small.
119    On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
120    implementing mbrtowc for encodings like UTF-8.  */
121 #if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
122 # if !GNULIB_defined_mbstate_t
123 typedef int rpl_mbstate_t;
124 #  undef mbstate_t
125 #  define mbstate_t rpl_mbstate_t
126 #  define GNULIB_defined_mbstate_t 1
127 # endif
128 #endif
129
130
131 /* Convert a single-byte character to a wide character.  */
132 #if @GNULIB_BTOWC@
133 # if @REPLACE_BTOWC@
134 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
135 #   undef btowc
136 #   define btowc rpl_btowc
137 #  endif
138 _GL_FUNCDECL_RPL (btowc, wint_t, (int c));
139 _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
140 # else
141 #  if !@HAVE_BTOWC@
142 _GL_FUNCDECL_SYS (btowc, wint_t, (int c));
143 #  endif
144 _GL_CXXALIAS_SYS (btowc, wint_t, (int c));
145 # endif
146 _GL_CXXALIASWARN (btowc);
147 #elif defined GNULIB_POSIXCHECK
148 # undef btowc
149 # if HAVE_RAW_DECL_BTOWC
150 _GL_WARN_ON_USE (btowc, "btowc is unportable - "
151                  "use gnulib module btowc for portability");
152 # endif
153 #endif
154
155
156 /* Convert a wide character to a single-byte character.  */
157 #if @GNULIB_WCTOB@
158 # if @REPLACE_WCTOB@
159 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
160 #   undef wctob
161 #   define wctob rpl_wctob
162 #  endif
163 _GL_FUNCDECL_RPL (wctob, int, (wint_t wc));
164 _GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
165 # else
166 #  if !defined wctob && !@HAVE_DECL_WCTOB@
167 /* wctob is provided by gnulib, or wctob exists but is not declared.  */
168 _GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
169 #  endif
170 _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
171 # endif
172 _GL_CXXALIASWARN (wctob);
173 #elif defined GNULIB_POSIXCHECK
174 # undef wctob
175 # if HAVE_RAW_DECL_WCTOB
176 _GL_WARN_ON_USE (wctob, "wctob is unportable - "
177                  "use gnulib module wctob for portability");
178 # endif
179 #endif
180
181
182 /* Test whether *PS is in the initial state.  */
183 #if @GNULIB_MBSINIT@
184 # if @REPLACE_MBSINIT@
185 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
186 #   undef mbsinit
187 #   define mbsinit rpl_mbsinit
188 #  endif
189 _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
190 _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
191 # else
192 #  if !@HAVE_MBSINIT@
193 _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
194 #  endif
195 _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
196 # endif
197 _GL_CXXALIASWARN (mbsinit);
198 #elif defined GNULIB_POSIXCHECK
199 # undef mbsinit
200 # if HAVE_RAW_DECL_MBSINIT
201 _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
202                  "use gnulib module mbsinit for portability");
203 # endif
204 #endif
205
206
207 /* Convert a multibyte character to a wide character.  */
208 #if @GNULIB_MBRTOWC@
209 # if @REPLACE_MBRTOWC@
210 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
211 #   undef mbrtowc
212 #   define mbrtowc rpl_mbrtowc
213 #  endif
214 _GL_FUNCDECL_RPL (mbrtowc, size_t,
215                   (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
216 _GL_CXXALIAS_RPL (mbrtowc, size_t,
217                   (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
218 # else
219 #  if !@HAVE_MBRTOWC@
220 _GL_FUNCDECL_SYS (mbrtowc, size_t,
221                   (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
222 #  endif
223 _GL_CXXALIAS_SYS (mbrtowc, size_t,
224                   (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
225 # endif
226 _GL_CXXALIASWARN (mbrtowc);
227 #elif defined GNULIB_POSIXCHECK
228 # undef mbrtowc
229 # if HAVE_RAW_DECL_MBRTOWC
230 _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
231                  "use gnulib module mbrtowc for portability");
232 # endif
233 #endif
234
235
236 /* Recognize a multibyte character.  */
237 #if @GNULIB_MBRLEN@
238 # if @REPLACE_MBRLEN@
239 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
240 #   undef mbrlen
241 #   define mbrlen rpl_mbrlen
242 #  endif
243 _GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
244 _GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
245 # else
246 #  if !@HAVE_MBRLEN@
247 _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
248 #  endif
249 _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
250 # endif
251 _GL_CXXALIASWARN (mbrlen);
252 #elif defined GNULIB_POSIXCHECK
253 # undef mbrlen
254 # if HAVE_RAW_DECL_MBRLEN
255 _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
256                  "use gnulib module mbrlen for portability");
257 # endif
258 #endif
259
260
261 /* Convert a string to a wide string.  */
262 #if @GNULIB_MBSRTOWCS@
263 # if @REPLACE_MBSRTOWCS@
264 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
265 #   undef mbsrtowcs
266 #   define mbsrtowcs rpl_mbsrtowcs
267 #  endif
268 _GL_FUNCDECL_RPL (mbsrtowcs, size_t,
269                   (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
270                   _GL_ARG_NONNULL ((2)));
271 _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
272                   (wchar_t *dest, const char **srcp, size_t len,
273                    mbstate_t *ps));
274 # else
275 #  if !@HAVE_MBSRTOWCS@
276 _GL_FUNCDECL_SYS (mbsrtowcs, size_t,
277                   (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
278                   _GL_ARG_NONNULL ((2)));
279 #  endif
280 _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
281                   (wchar_t *dest, const char **srcp, size_t len,
282                    mbstate_t *ps));
283 # endif
284 _GL_CXXALIASWARN (mbsrtowcs);
285 #elif defined GNULIB_POSIXCHECK
286 # undef mbsrtowcs
287 # if HAVE_RAW_DECL_MBSRTOWCS
288 _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
289                  "use gnulib module mbsrtowcs for portability");
290 # endif
291 #endif
292
293
294 /* Convert a string to a wide string.  */
295 #if @GNULIB_MBSNRTOWCS@
296 # if @REPLACE_MBSNRTOWCS@
297 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
298 #   undef mbsnrtowcs
299 #   define mbsnrtowcs rpl_mbsnrtowcs
300 #  endif
301 _GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
302                   (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
303                    mbstate_t *ps)
304                   _GL_ARG_NONNULL ((2)));
305 _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
306                   (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
307                    mbstate_t *ps));
308 # else
309 #  if !@HAVE_MBSNRTOWCS@
310 _GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
311                   (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
312                    mbstate_t *ps)
313                   _GL_ARG_NONNULL ((2)));
314 #  endif
315 _GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
316                   (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
317                    mbstate_t *ps));
318 # endif
319 _GL_CXXALIASWARN (mbsnrtowcs);
320 #elif defined GNULIB_POSIXCHECK
321 # undef mbsnrtowcs
322 # if HAVE_RAW_DECL_MBSNRTOWCS
323 _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
324                  "use gnulib module mbsnrtowcs for portability");
325 # endif
326 #endif
327
328
329 /* Convert a wide character to a multibyte character.  */
330 #if @GNULIB_WCRTOMB@
331 # if @REPLACE_WCRTOMB@
332 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
333 #   undef wcrtomb
334 #   define wcrtomb rpl_wcrtomb
335 #  endif
336 _GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
337 _GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
338 # else
339 #  if !@HAVE_WCRTOMB@
340 _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
341 #  endif
342 _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
343 # endif
344 _GL_CXXALIASWARN (wcrtomb);
345 #elif defined GNULIB_POSIXCHECK
346 # undef wcrtomb
347 # if HAVE_RAW_DECL_WCRTOMB
348 _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
349                  "use gnulib module wcrtomb for portability");
350 # endif
351 #endif
352
353
354 /* Convert a wide string to a string.  */
355 #if @GNULIB_WCSRTOMBS@
356 # if @REPLACE_WCSRTOMBS@
357 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
358 #   undef wcsrtombs
359 #   define wcsrtombs rpl_wcsrtombs
360 #  endif
361 _GL_FUNCDECL_RPL (wcsrtombs, size_t,
362                   (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
363                   _GL_ARG_NONNULL ((2)));
364 _GL_CXXALIAS_RPL (wcsrtombs, size_t,
365                   (char *dest, const wchar_t **srcp, size_t len,
366                    mbstate_t *ps));
367 # else
368 #  if !@HAVE_WCSRTOMBS@
369 _GL_FUNCDECL_SYS (wcsrtombs, size_t,
370                   (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
371                   _GL_ARG_NONNULL ((2)));
372 #  endif
373 _GL_CXXALIAS_SYS (wcsrtombs, size_t,
374                   (char *dest, const wchar_t **srcp, size_t len,
375                    mbstate_t *ps));
376 # endif
377 _GL_CXXALIASWARN (wcsrtombs);
378 #elif defined GNULIB_POSIXCHECK
379 # undef wcsrtombs
380 # if HAVE_RAW_DECL_WCSRTOMBS
381 _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
382                  "use gnulib module wcsrtombs for portability");
383 # endif
384 #endif
385
386
387 /* Convert a wide string to a string.  */
388 #if @GNULIB_WCSNRTOMBS@
389 # if @REPLACE_WCSNRTOMBS@
390 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
391 #   undef wcsnrtombs
392 #   define wcsnrtombs rpl_wcsnrtombs
393 #  endif
394 _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
395                   (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
396                    mbstate_t *ps)
397                   _GL_ARG_NONNULL ((2)));
398 _GL_CXXALIAS_RPL (wcsnrtombs, size_t,
399                   (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
400                    mbstate_t *ps));
401 # else
402 #  if !@HAVE_WCSNRTOMBS@
403 _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
404                   (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
405                    mbstate_t *ps)
406                   _GL_ARG_NONNULL ((2)));
407 #  endif
408 _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
409                   (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
410                    mbstate_t *ps));
411 # endif
412 _GL_CXXALIASWARN (wcsnrtombs);
413 #elif defined GNULIB_POSIXCHECK
414 # undef wcsnrtombs
415 # if HAVE_RAW_DECL_WCSNRTOMBS
416 _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
417                  "use gnulib module wcsnrtombs for portability");
418 # endif
419 #endif
420
421
422 /* Return the number of screen columns needed for WC.  */
423 #if @GNULIB_WCWIDTH@
424 # if @REPLACE_WCWIDTH@
425 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
426 #   undef wcwidth
427 #   define wcwidth rpl_wcwidth
428 #  endif
429 _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
430 _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
431 # else
432 #  if !@HAVE_DECL_WCWIDTH@
433 /* wcwidth exists but is not declared.  */
434 _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
435 #  endif
436 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
437 # endif
438 _GL_CXXALIASWARN (wcwidth);
439 #elif defined GNULIB_POSIXCHECK
440 # undef wcwidth
441 # if HAVE_RAW_DECL_WCWIDTH
442 _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
443                  "use gnulib module wcwidth for portability");
444 # endif
445 #endif
446
447
448 /* Search N wide characters of S for C.  */
449 #if @GNULIB_WMEMCHR@
450 # if !@HAVE_WMEMCHR@
451 _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
452 # endif
453   /* On some systems, this function is defined as an overloaded function:
454        extern "C++" {
455          const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
456          wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
457        }  */
458 _GL_CXXALIAS_SYS_CAST2 (wmemchr,
459                         wchar_t *, (const wchar_t *, wchar_t, size_t),
460                         const wchar_t *, (const wchar_t *, wchar_t, size_t));
461 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
462      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
463 _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
464 _GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
465                    (const wchar_t *s, wchar_t c, size_t n));
466 # else
467 _GL_CXXALIASWARN (wmemchr);
468 # endif
469 #elif defined GNULIB_POSIXCHECK
470 # undef wmemchr
471 # if HAVE_RAW_DECL_WMEMCHR
472 _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
473                  "use gnulib module wmemchr for portability");
474 # endif
475 #endif
476
477
478 /* Compare N wide characters of S1 and S2.  */
479 #if @GNULIB_WMEMCMP@
480 # if !@HAVE_WMEMCMP@
481 _GL_FUNCDECL_SYS (wmemcmp, int,
482                   (const wchar_t *s1, const wchar_t *s2, size_t n));
483 # endif
484 _GL_CXXALIAS_SYS (wmemcmp, int,
485                   (const wchar_t *s1, const wchar_t *s2, size_t n));
486 _GL_CXXALIASWARN (wmemcmp);
487 #elif defined GNULIB_POSIXCHECK
488 # undef wmemcmp
489 # if HAVE_RAW_DECL_WMEMCMP
490 _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
491                  "use gnulib module wmemcmp for portability");
492 # endif
493 #endif
494
495
496 /* Copy N wide characters of SRC to DEST.  */
497 #if @GNULIB_WMEMCPY@
498 # if !@HAVE_WMEMCPY@
499 _GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
500                   (wchar_t *dest, const wchar_t *src, size_t n));
501 # endif
502 _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
503                   (wchar_t *dest, const wchar_t *src, size_t n));
504 _GL_CXXALIASWARN (wmemcpy);
505 #elif defined GNULIB_POSIXCHECK
506 # undef wmemcpy
507 # if HAVE_RAW_DECL_WMEMCPY
508 _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
509                  "use gnulib module wmemcpy for portability");
510 # endif
511 #endif
512
513
514 /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
515    overlapping memory areas.  */
516 #if @GNULIB_WMEMMOVE@
517 # if !@HAVE_WMEMMOVE@
518 _GL_FUNCDECL_SYS (wmemmove, wchar_t *,
519                   (wchar_t *dest, const wchar_t *src, size_t n));
520 # endif
521 _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
522                   (wchar_t *dest, const wchar_t *src, size_t n));
523 _GL_CXXALIASWARN (wmemmove);
524 #elif defined GNULIB_POSIXCHECK
525 # undef wmemmove
526 # if HAVE_RAW_DECL_WMEMMOVE
527 _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
528                  "use gnulib module wmemmove for portability");
529 # endif
530 #endif
531
532
533 /* Set N wide characters of S to C.  */
534 #if @GNULIB_WMEMSET@
535 # if !@HAVE_WMEMSET@
536 _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
537 # endif
538 _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
539 _GL_CXXALIASWARN (wmemset);
540 #elif defined GNULIB_POSIXCHECK
541 # undef wmemset
542 # if HAVE_RAW_DECL_WMEMSET
543 _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
544                  "use gnulib module wmemset for portability");
545 # endif
546 #endif
547
548
549 /* Return the number of wide characters in S.  */
550 #if @GNULIB_WCSLEN@
551 # if !@HAVE_WCSLEN@
552 _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s));
553 # endif
554 _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
555 _GL_CXXALIASWARN (wcslen);
556 #elif defined GNULIB_POSIXCHECK
557 # undef wcslen
558 # if HAVE_RAW_DECL_WCSLEN
559 _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
560                  "use gnulib module wcslen for portability");
561 # endif
562 #endif
563
564
565 /* Return the number of wide characters in S, but at most MAXLEN.  */
566 #if @GNULIB_WCSNLEN@
567 # if !@HAVE_WCSNLEN@
568 _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
569 # endif
570 _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
571 _GL_CXXALIASWARN (wcsnlen);
572 #elif defined GNULIB_POSIXCHECK
573 # undef wcsnlen
574 # if HAVE_RAW_DECL_WCSNLEN
575 _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
576                  "use gnulib module wcsnlen for portability");
577 # endif
578 #endif
579
580
581 /* Copy SRC to DEST.  */
582 #if @GNULIB_WCSCPY@
583 # if !@HAVE_WCSCPY@
584 _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
585 # endif
586 _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
587 _GL_CXXALIASWARN (wcscpy);
588 #elif defined GNULIB_POSIXCHECK
589 # undef wcscpy
590 # if HAVE_RAW_DECL_WCSCPY
591 _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
592                  "use gnulib module wcscpy for portability");
593 # endif
594 #endif
595
596
597 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST.  */
598 #if @GNULIB_WCPCPY@
599 # if !@HAVE_WCPCPY@
600 _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
601 # endif
602 _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
603 _GL_CXXALIASWARN (wcpcpy);
604 #elif defined GNULIB_POSIXCHECK
605 # undef wcpcpy
606 # if HAVE_RAW_DECL_WCPCPY
607 _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
608                  "use gnulib module wcpcpy for portability");
609 # endif
610 #endif
611
612
613 /* Copy no more than N wide characters of SRC to DEST.  */
614 #if @GNULIB_WCSNCPY@
615 # if !@HAVE_WCSNCPY@
616 _GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
617                   (wchar_t *dest, const wchar_t *src, size_t n));
618 # endif
619 _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
620                   (wchar_t *dest, const wchar_t *src, size_t n));
621 _GL_CXXALIASWARN (wcsncpy);
622 #elif defined GNULIB_POSIXCHECK
623 # undef wcsncpy
624 # if HAVE_RAW_DECL_WCSNCPY
625 _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
626                  "use gnulib module wcsncpy for portability");
627 # endif
628 #endif
629
630
631 /* Copy no more than N characters of SRC to DEST, returning the address of
632    the last character written into DEST.  */
633 #if @GNULIB_WCPNCPY@
634 # if !@HAVE_WCPNCPY@
635 _GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
636                   (wchar_t *dest, const wchar_t *src, size_t n));
637 # endif
638 _GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
639                   (wchar_t *dest, const wchar_t *src, size_t n));
640 _GL_CXXALIASWARN (wcpncpy);
641 #elif defined GNULIB_POSIXCHECK
642 # undef wcpncpy
643 # if HAVE_RAW_DECL_WCPNCPY
644 _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
645                  "use gnulib module wcpncpy for portability");
646 # endif
647 #endif
648
649
650 /* Append SRC onto DEST.  */
651 #if @GNULIB_WCSCAT@
652 # if !@HAVE_WCSCAT@
653 _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
654 # endif
655 _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
656 _GL_CXXALIASWARN (wcscat);
657 #elif defined GNULIB_POSIXCHECK
658 # undef wcscat
659 # if HAVE_RAW_DECL_WCSCAT
660 _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
661                  "use gnulib module wcscat for portability");
662 # endif
663 #endif
664
665
666 /* Append no more than N wide characters of SRC onto DEST.  */
667 #if @GNULIB_WCSNCAT@
668 # if !@HAVE_WCSNCAT@
669 _GL_FUNCDECL_SYS (wcsncat, wchar_t *,
670                   (wchar_t *dest, const wchar_t *src, size_t n));
671 # endif
672 _GL_CXXALIAS_SYS (wcsncat, wchar_t *,
673                   (wchar_t *dest, const wchar_t *src, size_t n));
674 _GL_CXXALIASWARN (wcsncat);
675 #elif defined GNULIB_POSIXCHECK
676 # undef wcsncat
677 # if HAVE_RAW_DECL_WCSNCAT
678 _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
679                  "use gnulib module wcsncat for portability");
680 # endif
681 #endif
682
683
684 /* Compare S1 and S2.  */
685 #if @GNULIB_WCSCMP@
686 # if !@HAVE_WCSCMP@
687 _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
688 # endif
689 _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
690 _GL_CXXALIASWARN (wcscmp);
691 #elif defined GNULIB_POSIXCHECK
692 # undef wcscmp
693 # if HAVE_RAW_DECL_WCSCMP
694 _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
695                  "use gnulib module wcscmp for portability");
696 # endif
697 #endif
698
699
700 /* Compare no more than N wide characters of S1 and S2.  */
701 #if @GNULIB_WCSNCMP@
702 # if !@HAVE_WCSNCMP@
703 _GL_FUNCDECL_SYS (wcsncmp, int,
704                   (const wchar_t *s1, const wchar_t *s2, size_t n));
705 # endif
706 _GL_CXXALIAS_SYS (wcsncmp, int,
707                   (const wchar_t *s1, const wchar_t *s2, size_t n));
708 _GL_CXXALIASWARN (wcsncmp);
709 #elif defined GNULIB_POSIXCHECK
710 # undef wcsncmp
711 # if HAVE_RAW_DECL_WCSNCMP
712 _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
713                  "use gnulib module wcsncmp for portability");
714 # endif
715 #endif
716
717
718 /* Compare S1 and S2, ignoring case.  */
719 #if @GNULIB_WCSCASECMP@
720 # if !@HAVE_WCSCASECMP@
721 _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
722 # endif
723 _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
724 _GL_CXXALIASWARN (wcscasecmp);
725 #elif defined GNULIB_POSIXCHECK
726 # undef wcscasecmp
727 # if HAVE_RAW_DECL_WCSCASECMP
728 _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
729                  "use gnulib module wcscasecmp for portability");
730 # endif
731 #endif
732
733
734 /* Compare no more than N chars of S1 and S2, ignoring case.  */
735 #if @GNULIB_WCSNCASECMP@
736 # if !@HAVE_WCSNCASECMP@
737 _GL_FUNCDECL_SYS (wcsncasecmp, int,
738                   (const wchar_t *s1, const wchar_t *s2, size_t n));
739 # endif
740 _GL_CXXALIAS_SYS (wcsncasecmp, int,
741                   (const wchar_t *s1, const wchar_t *s2, size_t n));
742 _GL_CXXALIASWARN (wcsncasecmp);
743 #elif defined GNULIB_POSIXCHECK
744 # undef wcsncasecmp
745 # if HAVE_RAW_DECL_WCSNCASECMP
746 _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
747                  "use gnulib module wcsncasecmp for portability");
748 # endif
749 #endif
750
751
752 /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
753    category of the current locale.  */
754 #if @GNULIB_WCSCOLL@
755 # if !@HAVE_WCSCOLL@
756 _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
757 # endif
758 _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
759 _GL_CXXALIASWARN (wcscoll);
760 #elif defined GNULIB_POSIXCHECK
761 # undef wcscoll
762 # if HAVE_RAW_DECL_WCSCOLL
763 _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
764                  "use gnulib module wcscoll for portability");
765 # endif
766 #endif
767
768
769 /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
770    to two transformed strings the result is the as applying 'wcscoll' to the
771    original strings.  */
772 #if @GNULIB_WCSXFRM@
773 # if !@HAVE_WCSXFRM@
774 _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
775 # endif
776 _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
777 _GL_CXXALIASWARN (wcsxfrm);
778 #elif defined GNULIB_POSIXCHECK
779 # undef wcsxfrm
780 # if HAVE_RAW_DECL_WCSXFRM
781 _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
782                  "use gnulib module wcsxfrm for portability");
783 # endif
784 #endif
785
786
787 /* Duplicate S, returning an identical malloc'd string.  */
788 #if @GNULIB_WCSDUP@
789 # if !@HAVE_WCSDUP@
790 _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
791 # endif
792 _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
793 _GL_CXXALIASWARN (wcsdup);
794 #elif defined GNULIB_POSIXCHECK
795 # undef wcsdup
796 # if HAVE_RAW_DECL_WCSDUP
797 _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
798                  "use gnulib module wcsdup for portability");
799 # endif
800 #endif
801
802
803 /* Find the first occurrence of WC in WCS.  */
804 #if @GNULIB_WCSCHR@
805 # if !@HAVE_WCSCHR@
806 _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
807 # endif
808   /* On some systems, this function is defined as an overloaded function:
809        extern "C++" {
810          const wchar_t * std::wcschr (const wchar_t *, wchar_t);
811          wchar_t * std::wcschr (wchar_t *, wchar_t);
812        }  */
813 _GL_CXXALIAS_SYS_CAST2 (wcschr,
814                         wchar_t *, (const wchar_t *, wchar_t),
815                         const wchar_t *, (const wchar_t *, wchar_t));
816 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
817      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
818 _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
819 _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
820 # else
821 _GL_CXXALIASWARN (wcschr);
822 # endif
823 #elif defined GNULIB_POSIXCHECK
824 # undef wcschr
825 # if HAVE_RAW_DECL_WCSCHR
826 _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
827                  "use gnulib module wcschr for portability");
828 # endif
829 #endif
830
831
832 /* Find the last occurrence of WC in WCS.  */
833 #if @GNULIB_WCSRCHR@
834 # if !@HAVE_WCSRCHR@
835 _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
836 # endif
837   /* On some systems, this function is defined as an overloaded function:
838        extern "C++" {
839          const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
840          wchar_t * std::wcsrchr (wchar_t *, wchar_t);
841        }  */
842 _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
843                         wchar_t *, (const wchar_t *, wchar_t),
844                         const wchar_t *, (const wchar_t *, wchar_t));
845 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
846      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
847 _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
848 _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
849 # else
850 _GL_CXXALIASWARN (wcsrchr);
851 # endif
852 #elif defined GNULIB_POSIXCHECK
853 # undef wcsrchr
854 # if HAVE_RAW_DECL_WCSRCHR
855 _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
856                  "use gnulib module wcsrchr for portability");
857 # endif
858 #endif
859
860
861 /* Return the length of the initial segmet of WCS which consists entirely
862    of wide characters not in REJECT.  */
863 #if @GNULIB_WCSCSPN@
864 # if !@HAVE_WCSCSPN@
865 _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
866 # endif
867 _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
868 _GL_CXXALIASWARN (wcscspn);
869 #elif defined GNULIB_POSIXCHECK
870 # undef wcscspn
871 # if HAVE_RAW_DECL_WCSCSPN
872 _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
873                  "use gnulib module wcscspn for portability");
874 # endif
875 #endif
876
877
878 /* Return the length of the initial segmet of WCS which consists entirely
879    of wide characters in ACCEPT.  */
880 #if @GNULIB_WCSSPN@
881 # if !@HAVE_WCSSPN@
882 _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
883 # endif
884 _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
885 _GL_CXXALIASWARN (wcsspn);
886 #elif defined GNULIB_POSIXCHECK
887 # undef wcsspn
888 # if HAVE_RAW_DECL_WCSSPN
889 _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
890                  "use gnulib module wcsspn for portability");
891 # endif
892 #endif
893
894
895 /* Find the first occurrence in WCS of any character in ACCEPT.  */
896 #if @GNULIB_WCSPBRK@
897 # if !@HAVE_WCSPBRK@
898 _GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
899                   (const wchar_t *wcs, const wchar_t *accept));
900 # endif
901   /* On some systems, this function is defined as an overloaded function:
902        extern "C++" {
903          const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
904          wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
905        }  */
906 _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
907                         wchar_t *, (const wchar_t *, const wchar_t *),
908                         const wchar_t *, (const wchar_t *, const wchar_t *));
909 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
910      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
911 _GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
912                    (wchar_t *wcs, const wchar_t *accept));
913 _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
914                    (const wchar_t *wcs, const wchar_t *accept));
915 # else
916 _GL_CXXALIASWARN (wcspbrk);
917 # endif
918 #elif defined GNULIB_POSIXCHECK
919 # undef wcspbrk
920 # if HAVE_RAW_DECL_WCSPBRK
921 _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
922                  "use gnulib module wcspbrk for portability");
923 # endif
924 #endif
925
926
927 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
928 #if @GNULIB_WCSSTR@
929 # if !@HAVE_WCSSTR@
930 _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
931                   (const wchar_t *haystack, const wchar_t *needle));
932 # endif
933   /* On some systems, this function is defined as an overloaded function:
934        extern "C++" {
935          const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
936          wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
937        }  */
938 _GL_CXXALIAS_SYS_CAST2 (wcsstr,
939                         wchar_t *, (const wchar_t *, const wchar_t *),
940                         const wchar_t *, (const wchar_t *, const wchar_t *));
941 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
942      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
943 _GL_CXXALIASWARN1 (wcsstr, wchar_t *,
944                    (wchar_t *haystack, const wchar_t *needle));
945 _GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
946                    (const wchar_t *haystack, const wchar_t *needle));
947 # else
948 _GL_CXXALIASWARN (wcsstr);
949 # endif
950 #elif defined GNULIB_POSIXCHECK
951 # undef wcsstr
952 # if HAVE_RAW_DECL_WCSSTR
953 _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
954                  "use gnulib module wcsstr for portability");
955 # endif
956 #endif
957
958
959 /* Divide WCS into tokens separated by characters in DELIM.  */
960 #if @GNULIB_WCSTOK@
961 # if !@HAVE_WCSTOK@
962 _GL_FUNCDECL_SYS (wcstok, wchar_t *,
963                   (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
964 # endif
965 _GL_CXXALIAS_SYS (wcstok, wchar_t *,
966                   (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
967 _GL_CXXALIASWARN (wcstok);
968 #elif defined GNULIB_POSIXCHECK
969 # undef wcstok
970 # if HAVE_RAW_DECL_WCSTOK
971 _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
972                  "use gnulib module wcstok for portability");
973 # endif
974 #endif
975
976
977 /* Determine number of column positions required for first N wide
978    characters (or fewer if S ends before this) in S.  */
979 #if @GNULIB_WCSWIDTH@
980 # if @REPLACE_WCSWIDTH@
981 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
982 #   undef wcswidth
983 #   define wcswidth rpl_wcswidth
984 #  endif
985 _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n));
986 _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
987 # else
988 #  if !@HAVE_WCSWIDTH@
989 _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n));
990 #  endif
991 _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
992 # endif
993 _GL_CXXALIASWARN (wcswidth);
994 #elif defined GNULIB_POSIXCHECK
995 # undef wcswidth
996 # if HAVE_RAW_DECL_WCSWIDTH
997 _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
998                  "use gnulib module wcswidth for portability");
999 # endif
1000 #endif
1001
1002
1003 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1004 #endif /* _@GUARD_PREFIX@_WCHAR_H */
1005 #endif