summaryrefslogtreecommitdiffstats
path: root/gl/wchar.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/wchar.in.h')
-rw-r--r--gl/wchar.in.h346
1 files changed, 232 insertions, 114 deletions
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index cc5baad..dd41d35 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -1,6 +1,6 @@
1/* A substitute for ISO C99 <wchar.h>, for platforms that have issues. 1/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
2 2
3 Copyright (C) 2007-2009 Free Software Foundation, Inc. 3 Copyright (C) 2007-2010 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -30,9 +30,9 @@
30@PRAGMA_SYSTEM_HEADER@ 30@PRAGMA_SYSTEM_HEADER@
31#endif 31#endif
32 32
33#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H 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: 34/* Special invocation convention:
35 - Inside uClibc header files. 35 - Inside glibc and uClibc header files.
36 - On HP-UX 11.00 we have a sequence of nested includes 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>, 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> 38 once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
@@ -55,10 +55,13 @@
55/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 55/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
56 <wchar.h>. 56 <wchar.h>.
57 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be 57 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
58 included before <wchar.h>. */ 58 included before <wchar.h>.
59#include <stddef.h> 59 But avoid namespace pollution on glibc systems. */
60#include <stdio.h> 60#ifndef __GLIBC__
61#include <time.h> 61# include <stddef.h>
62# include <stdio.h>
63# include <time.h>
64#endif
62 65
63/* Include the original <wchar.h> if it exists. 66/* Include the original <wchar.h> if it exists.
64 Some builds of uClibc lack it. */ 67 Some builds of uClibc lack it. */
@@ -72,19 +75,23 @@
72#ifndef _GL_WCHAR_H 75#ifndef _GL_WCHAR_H
73#define _GL_WCHAR_H 76#define _GL_WCHAR_H
74 77
75/* The definition of GL_LINK_WARNING is copied here. */ 78/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
76 79
77#ifdef __cplusplus 80/* The definition of _GL_ARG_NONNULL is copied here. */
78extern "C" {
79#endif
80 81
82/* The definition of _GL_WARN_ON_USE is copied here. */
81 83
82/* Define wint_t. (Also done in wctype.in.h.) */ 84
85/* Define wint_t and WEOF. (Also done in wctype.in.h.) */
83#if !@HAVE_WINT_T@ && !defined wint_t 86#if !@HAVE_WINT_T@ && !defined wint_t
84# define wint_t int 87# define wint_t int
85# ifndef WEOF 88# ifndef WEOF
86# define WEOF -1 89# define WEOF -1
87# endif 90# endif
91#else
92# ifndef WEOF
93# define WEOF ((wint_t) -1)
94# endif
88#endif 95#endif
89 96
90 97
@@ -102,209 +109,320 @@ typedef int rpl_mbstate_t;
102/* Convert a single-byte character to a wide character. */ 109/* Convert a single-byte character to a wide character. */
103#if @GNULIB_BTOWC@ 110#if @GNULIB_BTOWC@
104# if @REPLACE_BTOWC@ 111# if @REPLACE_BTOWC@
105# undef btowc 112# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
106# define btowc rpl_btowc 113# undef btowc
107# endif 114# define btowc rpl_btowc
108# if !@HAVE_BTOWC@ || @REPLACE_BTOWC@ 115# endif
109extern wint_t btowc (int c); 116_GL_FUNCDECL_RPL (btowc, wint_t, (int c));
117_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
118# else
119# if !@HAVE_BTOWC@
120_GL_FUNCDECL_SYS (btowc, wint_t, (int c));
121# endif
122_GL_CXXALIAS_SYS (btowc, wint_t, (int c));
110# endif 123# endif
124_GL_CXXALIASWARN (btowc);
111#elif defined GNULIB_POSIXCHECK 125#elif defined GNULIB_POSIXCHECK
112# undef btowc 126# undef btowc
113# define btowc(c) \ 127# if HAVE_RAW_DECL_BTOWC
114 (GL_LINK_WARNING ("btowc is unportable - " \ 128_GL_WARN_ON_USE (btowc, "btowc is unportable - "
115 "use gnulib module btowc for portability"), \ 129 "use gnulib module btowc for portability");
116 btowc (c)) 130# endif
117#endif 131#endif
118 132
119 133
120/* Convert a wide character to a single-byte character. */ 134/* Convert a wide character to a single-byte character. */
121#if @GNULIB_WCTOB@ 135#if @GNULIB_WCTOB@
122# if @REPLACE_WCTOB@ 136# if @REPLACE_WCTOB@
123# undef wctob 137# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
124# define wctob rpl_wctob 138# undef wctob
125# endif 139# define wctob rpl_wctob
126# if (!defined wctob && !@HAVE_DECL_WCTOB@) || @REPLACE_WCTOB@ 140# endif
141_GL_FUNCDECL_RPL (wctob, int, (wint_t wc));
142_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
143# else
144# if !defined wctob && !@HAVE_DECL_WCTOB@
127/* wctob is provided by gnulib, or wctob exists but is not declared. */ 145/* wctob is provided by gnulib, or wctob exists but is not declared. */
128extern int wctob (wint_t wc); 146_GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
147# endif
148_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
129# endif 149# endif
150_GL_CXXALIASWARN (wctob);
130#elif defined GNULIB_POSIXCHECK 151#elif defined GNULIB_POSIXCHECK
131# undef wctob 152# undef wctob
132# define wctob(w) \ 153# if HAVE_RAW_DECL_WCTOB
133 (GL_LINK_WARNING ("wctob is unportable - " \ 154_GL_WARN_ON_USE (wctob, "wctob is unportable - "
134 "use gnulib module wctob for portability"), \ 155 "use gnulib module wctob for portability");
135 wctob (w)) 156# endif
136#endif 157#endif
137 158
138 159
139/* Test whether *PS is in the initial state. */ 160/* Test whether *PS is in the initial state. */
140#if @GNULIB_MBSINIT@ 161#if @GNULIB_MBSINIT@
141# if @REPLACE_MBSINIT@ 162# if @REPLACE_MBSINIT@
142# undef mbsinit 163# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
143# define mbsinit rpl_mbsinit 164# undef mbsinit
144# endif 165# define mbsinit rpl_mbsinit
145# if !@HAVE_MBSINIT@ || @REPLACE_MBSINIT@ 166# endif
146extern int mbsinit (const mbstate_t *ps); 167_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
168_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
169# else
170# if !@HAVE_MBSINIT@
171_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
172# endif
173_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
147# endif 174# endif
175_GL_CXXALIASWARN (mbsinit);
148#elif defined GNULIB_POSIXCHECK 176#elif defined GNULIB_POSIXCHECK
149# undef mbsinit 177# undef mbsinit
150# define mbsinit(p) \ 178# if HAVE_RAW_DECL_MBSINIT
151 (GL_LINK_WARNING ("mbsinit is unportable - " \ 179_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
152 "use gnulib module mbsinit for portability"), \ 180 "use gnulib module mbsinit for portability");
153 mbsinit (p)) 181# endif
154#endif 182#endif
155 183
156 184
157/* Convert a multibyte character to a wide character. */ 185/* Convert a multibyte character to a wide character. */
158#if @GNULIB_MBRTOWC@ 186#if @GNULIB_MBRTOWC@
159# if @REPLACE_MBRTOWC@ 187# if @REPLACE_MBRTOWC@
160# undef mbrtowc 188# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
161# define mbrtowc rpl_mbrtowc 189# undef mbrtowc
162# endif 190# define mbrtowc rpl_mbrtowc
163# if !@HAVE_MBRTOWC@ || @REPLACE_MBRTOWC@ 191# endif
164extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); 192_GL_FUNCDECL_RPL (mbrtowc, size_t,
193 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
194_GL_CXXALIAS_RPL (mbrtowc, size_t,
195 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
196# else
197# if !@HAVE_MBRTOWC@
198_GL_FUNCDECL_SYS (mbrtowc, size_t,
199 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
200# endif
201_GL_CXXALIAS_SYS (mbrtowc, size_t,
202 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
165# endif 203# endif
204_GL_CXXALIASWARN (mbrtowc);
166#elif defined GNULIB_POSIXCHECK 205#elif defined GNULIB_POSIXCHECK
167# undef mbrtowc 206# undef mbrtowc
168# define mbrtowc(w,s,n,p) \ 207# if HAVE_RAW_DECL_MBRTOWC
169 (GL_LINK_WARNING ("mbrtowc is unportable - " \ 208_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
170 "use gnulib module mbrtowc for portability"), \ 209 "use gnulib module mbrtowc for portability");
171 mbrtowc (w, s, n, p)) 210# endif
172#endif 211#endif
173 212
174 213
175/* Recognize a multibyte character. */ 214/* Recognize a multibyte character. */
176#if @GNULIB_MBRLEN@ 215#if @GNULIB_MBRLEN@
177# if @REPLACE_MBRLEN@ 216# if @REPLACE_MBRLEN@
178# undef mbrlen 217# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
179# define mbrlen rpl_mbrlen 218# undef mbrlen
180# endif 219# define mbrlen rpl_mbrlen
181# if !@HAVE_MBRLEN@ || @REPLACE_MBRLEN@ 220# endif
182extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps); 221_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
222_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
223# else
224# if !@HAVE_MBRLEN@
225_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
226# endif
227_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
183# endif 228# endif
229_GL_CXXALIASWARN (mbrlen);
184#elif defined GNULIB_POSIXCHECK 230#elif defined GNULIB_POSIXCHECK
185# undef mbrlen 231# undef mbrlen
186# define mbrlen(s,n,p) \ 232# if HAVE_RAW_DECL_MBRLEN
187 (GL_LINK_WARNING ("mbrlen is unportable - " \ 233_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
188 "use gnulib module mbrlen for portability"), \ 234 "use gnulib module mbrlen for portability");
189 mbrlen (s, n, p)) 235# endif
190#endif 236#endif
191 237
192 238
193/* Convert a string to a wide string. */ 239/* Convert a string to a wide string. */
194#if @GNULIB_MBSRTOWCS@ 240#if @GNULIB_MBSRTOWCS@
195# if @REPLACE_MBSRTOWCS@ 241# if @REPLACE_MBSRTOWCS@
196# undef mbsrtowcs 242# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
197# define mbsrtowcs rpl_mbsrtowcs 243# undef mbsrtowcs
198# endif 244# define mbsrtowcs rpl_mbsrtowcs
199# if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@ 245# endif
200extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps); 246_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
247 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
248 _GL_ARG_NONNULL ((2)));
249_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
250 (wchar_t *dest, const char **srcp, size_t len,
251 mbstate_t *ps));
252# else
253# if !@HAVE_MBSRTOWCS@
254_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
255 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
256 _GL_ARG_NONNULL ((2)));
257# endif
258_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
259 (wchar_t *dest, const char **srcp, size_t len,
260 mbstate_t *ps));
201# endif 261# endif
262_GL_CXXALIASWARN (mbsrtowcs);
202#elif defined GNULIB_POSIXCHECK 263#elif defined GNULIB_POSIXCHECK
203# undef mbsrtowcs 264# undef mbsrtowcs
204# define mbsrtowcs(d,s,l,p) \ 265# if HAVE_RAW_DECL_MBSRTOWCS
205 (GL_LINK_WARNING ("mbsrtowcs is unportable - " \ 266_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
206 "use gnulib module mbsrtowcs for portability"), \ 267 "use gnulib module mbsrtowcs for portability");
207 mbsrtowcs (d, s, l, p)) 268# endif
208#endif 269#endif
209 270
210 271
211/* Convert a string to a wide string. */ 272/* Convert a string to a wide string. */
212#if @GNULIB_MBSNRTOWCS@ 273#if @GNULIB_MBSNRTOWCS@
213# if @REPLACE_MBSNRTOWCS@ 274# if @REPLACE_MBSNRTOWCS@
214# undef mbsnrtowcs 275# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
215# define mbsnrtowcs rpl_mbsnrtowcs 276# undef mbsnrtowcs
216# endif 277# define mbsnrtowcs rpl_mbsnrtowcs
217# if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@ 278# endif
218extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps); 279_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
280 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
281 mbstate_t *ps)
282 _GL_ARG_NONNULL ((2)));
283_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
284 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
285 mbstate_t *ps));
286# else
287# if !@HAVE_MBSNRTOWCS@
288_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
289 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
290 mbstate_t *ps)
291 _GL_ARG_NONNULL ((2)));
292# endif
293_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
294 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
295 mbstate_t *ps));
219# endif 296# endif
297_GL_CXXALIASWARN (mbsnrtowcs);
220#elif defined GNULIB_POSIXCHECK 298#elif defined GNULIB_POSIXCHECK
221# undef mbsnrtowcs 299# undef mbsnrtowcs
222# define mbsnrtowcs(d,s,n,l,p) \ 300# if HAVE_RAW_DECL_MBSNRTOWCS
223 (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \ 301_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
224 "use gnulib module mbsnrtowcs for portability"), \ 302 "use gnulib module mbsnrtowcs for portability");
225 mbsnrtowcs (d, s, n, l, p)) 303# endif
226#endif 304#endif
227 305
228 306
229/* Convert a wide character to a multibyte character. */ 307/* Convert a wide character to a multibyte character. */
230#if @GNULIB_WCRTOMB@ 308#if @GNULIB_WCRTOMB@
231# if @REPLACE_WCRTOMB@ 309# if @REPLACE_WCRTOMB@
232# undef wcrtomb 310# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
233# define wcrtomb rpl_wcrtomb 311# undef wcrtomb
234# endif 312# define wcrtomb rpl_wcrtomb
235# if !@HAVE_WCRTOMB@ || @REPLACE_WCRTOMB@ 313# endif
236extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps); 314_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
315_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
316# else
317# if !@HAVE_WCRTOMB@
318_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
319# endif
320_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
237# endif 321# endif
322_GL_CXXALIASWARN (wcrtomb);
238#elif defined GNULIB_POSIXCHECK 323#elif defined GNULIB_POSIXCHECK
239# undef wcrtomb 324# undef wcrtomb
240# define wcrtomb(s,w,p) \ 325# if HAVE_RAW_DECL_WCRTOMB
241 (GL_LINK_WARNING ("wcrtomb is unportable - " \ 326_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
242 "use gnulib module wcrtomb for portability"), \ 327 "use gnulib module wcrtomb for portability");
243 wcrtomb (s, w, p)) 328# endif
244#endif 329#endif
245 330
246 331
247/* Convert a wide string to a string. */ 332/* Convert a wide string to a string. */
248#if @GNULIB_WCSRTOMBS@ 333#if @GNULIB_WCSRTOMBS@
249# if @REPLACE_WCSRTOMBS@ 334# if @REPLACE_WCSRTOMBS@
250# undef wcsrtombs 335# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
251# define wcsrtombs rpl_wcsrtombs 336# undef wcsrtombs
252# endif 337# define wcsrtombs rpl_wcsrtombs
253# if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@ 338# endif
254extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps); 339_GL_FUNCDECL_RPL (wcsrtombs, size_t,
340 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
341 _GL_ARG_NONNULL ((2)));
342_GL_CXXALIAS_RPL (wcsrtombs, size_t,
343 (char *dest, const wchar_t **srcp, size_t len,
344 mbstate_t *ps));
345# else
346# if !@HAVE_WCSRTOMBS@
347_GL_FUNCDECL_SYS (wcsrtombs, size_t,
348 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
349 _GL_ARG_NONNULL ((2)));
350# endif
351_GL_CXXALIAS_SYS (wcsrtombs, size_t,
352 (char *dest, const wchar_t **srcp, size_t len,
353 mbstate_t *ps));
255# endif 354# endif
355_GL_CXXALIASWARN (wcsrtombs);
256#elif defined GNULIB_POSIXCHECK 356#elif defined GNULIB_POSIXCHECK
257# undef wcsrtombs 357# undef wcsrtombs
258# define wcsrtombs(d,s,l,p) \ 358# if HAVE_RAW_DECL_WCSRTOMBS
259 (GL_LINK_WARNING ("wcsrtombs is unportable - " \ 359_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
260 "use gnulib module wcsrtombs for portability"), \ 360 "use gnulib module wcsrtombs for portability");
261 wcsrtombs (d, s, l, p)) 361# endif
262#endif 362#endif
263 363
264 364
265/* Convert a wide string to a string. */ 365/* Convert a wide string to a string. */
266#if @GNULIB_WCSNRTOMBS@ 366#if @GNULIB_WCSNRTOMBS@
267# if @REPLACE_WCSNRTOMBS@ 367# if @REPLACE_WCSNRTOMBS@
268# undef wcsnrtombs 368# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
269# define wcsnrtombs rpl_wcsnrtombs 369# undef wcsnrtombs
270# endif 370# define wcsnrtombs rpl_wcsnrtombs
271# if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@ 371# endif
272extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps); 372_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
373 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
374 mbstate_t *ps)
375 _GL_ARG_NONNULL ((2)));
376_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
377 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
378 mbstate_t *ps));
379# else
380# if !@HAVE_WCSNRTOMBS@
381_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
382 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
383 mbstate_t *ps)
384 _GL_ARG_NONNULL ((2)));
385# endif
386_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
387 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
388 mbstate_t *ps));
273# endif 389# endif
390_GL_CXXALIASWARN (wcsnrtombs);
274#elif defined GNULIB_POSIXCHECK 391#elif defined GNULIB_POSIXCHECK
275# undef wcsnrtombs 392# undef wcsnrtombs
276# define wcsnrtombs(d,s,n,l,p) \ 393# if HAVE_RAW_DECL_WCSNRTOMBS
277 (GL_LINK_WARNING ("wcsnrtombs is unportable - " \ 394_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
278 "use gnulib module wcsnrtombs for portability"), \ 395 "use gnulib module wcsnrtombs for portability");
279 wcsnrtombs (d, s, n, l, p)) 396# endif
280#endif 397#endif
281 398
282 399
283/* Return the number of screen columns needed for WC. */ 400/* Return the number of screen columns needed for WC. */
284#if @GNULIB_WCWIDTH@ 401#if @GNULIB_WCWIDTH@
285# if @REPLACE_WCWIDTH@ 402# if @REPLACE_WCWIDTH@
286# undef wcwidth 403# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
287# define wcwidth rpl_wcwidth 404# undef wcwidth
288extern int wcwidth (wchar_t); 405# define wcwidth rpl_wcwidth
406# endif
407_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
408_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
289# else 409# else
290# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@ 410# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@
291/* wcwidth exists but is not declared. */ 411/* wcwidth exists but is not declared. */
292extern int wcwidth (int /* actually wchar_t */); 412_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
293# endif 413# endif
414_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
294# endif 415# endif
416_GL_CXXALIASWARN (wcwidth);
295#elif defined GNULIB_POSIXCHECK 417#elif defined GNULIB_POSIXCHECK
296# undef wcwidth 418# undef wcwidth
297# define wcwidth(w) \ 419# if HAVE_RAW_DECL_WCWIDTH
298 (GL_LINK_WARNING ("wcwidth is unportable - " \ 420_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
299 "use gnulib module wcwidth for portability"), \ 421 "use gnulib module wcwidth for portability");
300 wcwidth (w)) 422# endif
301#endif 423#endif
302 424
303 425
304#ifdef __cplusplus
305}
306#endif
307
308#endif /* _GL_WCHAR_H */ 426#endif /* _GL_WCHAR_H */
309#endif /* _GL_WCHAR_H */ 427#endif /* _GL_WCHAR_H */
310#endif 428#endif