]>
Commit | Line | Data |
---|---|---|
6796bc80 | 1 | #ifndef _WCHAR_H |
86005fdb PM |
2 | |
3 | /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ | |
4 | # include <bits/floatn.h> | |
e2239af3 | 5 | # if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 |
86005fdb PM |
6 | # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) |
7 | # pragma GCC system_header | |
8 | # endif | |
9 | # endif | |
10 | ||
199fc19d | 11 | # include <wcsmbs/wchar.h> |
31341567 | 12 | # ifndef _ISOMAC |
509d1b68 | 13 | |
45f39d45 | 14 | #include <bits/floatn.h> |
04d85feb | 15 | #include <bits/wchar2-decl.h> |
64924422 | 16 | #include <stdbool.h> |
45f39d45 | 17 | |
da4cfe38 RM |
18 | extern __typeof (wcscasecmp_l) __wcscasecmp_l; |
19 | extern __typeof (wcsncasecmp_l) __wcsncasecmp_l; | |
20 | extern __typeof (wcscoll_l) __wcscoll_l; | |
21 | extern __typeof (wcsxfrm_l) __wcsxfrm_l; | |
22 | extern __typeof (wcstol_l) __wcstol_l; | |
23 | extern __typeof (wcstoul_l) __wcstoul_l; | |
24 | extern __typeof (wcstoll_l) __wcstoll_l; | |
25 | extern __typeof (wcstoull_l) __wcstoull_l; | |
26 | extern __typeof (wcstod_l) __wcstod_l; | |
27 | extern __typeof (wcstof_l) __wcstof_l; | |
28 | extern __typeof (wcstold_l) __wcstold_l; | |
29 | extern __typeof (wcsftime_l) __wcsftime_l; | |
773e305e RM |
30 | libc_hidden_proto (__wcstol_l) |
31 | libc_hidden_proto (__wcstoul_l) | |
32 | libc_hidden_proto (__wcstoll_l) | |
33 | libc_hidden_proto (__wcstoull_l) | |
34 | libc_hidden_proto (__wcstod_l) | |
35 | libc_hidden_proto (__wcstof_l) | |
36 | libc_hidden_proto (__wcstold_l) | |
ee2a5ae8 | 37 | libc_hidden_proto (__wcsftime_l) |
da4cfe38 | 38 | |
64924422 JM |
39 | extern __typeof (wcstol) __isoc23_wcstol __attribute_copy__ (wcstol); |
40 | extern __typeof (wcstoul) __isoc23_wcstoul __attribute_copy__ (wcstoul); | |
41 | extern __typeof (wcstoll) __isoc23_wcstoll __attribute_copy__ (wcstoll); | |
42 | extern __typeof (wcstoull) __isoc23_wcstoull __attribute_copy__ (wcstoull); | |
43 | extern __typeof (wcstol_l) __isoc23_wcstol_l __attribute_copy__ (wcstol_l); | |
44 | extern __typeof (wcstoul_l) __isoc23_wcstoul_l __attribute_copy__ (wcstoul_l); | |
45 | extern __typeof (wcstoll_l) __isoc23_wcstoll_l __attribute_copy__ (wcstoll_l); | |
46 | extern __typeof (wcstoull_l) __isoc23_wcstoull_l __attribute_copy__ (wcstoull_l); | |
47 | libc_hidden_proto (__isoc23_wcstol) | |
48 | libc_hidden_proto (__isoc23_wcstoul) | |
49 | libc_hidden_proto (__isoc23_wcstoll) | |
50 | libc_hidden_proto (__isoc23_wcstoull) | |
51 | libc_hidden_proto (__isoc23_wcstol_l) | |
52 | libc_hidden_proto (__isoc23_wcstoul_l) | |
53 | libc_hidden_proto (__isoc23_wcstoll_l) | |
54 | libc_hidden_proto (__isoc23_wcstoull_l) | |
55 | ||
42cc619d JM |
56 | #if __GLIBC_USE (C23_STRTOL) |
57 | /* Redirect internal uses of these functions to the C23 versions; the | |
64924422 JM |
58 | redirection in the installed header does not work with |
59 | libc_hidden_proto. */ | |
60 | # undef wcstol | |
61 | # define wcstol __isoc23_wcstol | |
62 | # undef wcstoul | |
63 | # define wcstoul __isoc23_wcstoul | |
64 | # undef wcstoll | |
65 | # define wcstoll __isoc23_wcstoll | |
66 | # undef wcstoull | |
67 | # define wcstoull __isoc23_wcstoull | |
68 | # undef wcstol_l | |
69 | # define wcstol_l __isoc23_wcstol_l | |
70 | # undef wcstoul_l | |
71 | # define wcstoul_l __isoc23_wcstoul_l | |
72 | # undef wcstoll_l | |
73 | # define wcstoll_l __isoc23_wcstoll_l | |
74 | # undef wcstoull_l | |
75 | # define wcstoull_l __isoc23_wcstoull_l | |
76 | #endif | |
77 | ||
da4cfe38 | 78 | |
a784e502 | 79 | extern double __wcstod_internal (const wchar_t *__restrict __nptr, |
9b2e9577 UD |
80 | wchar_t **__restrict __endptr, int __group) |
81 | __THROW; | |
a784e502 | 82 | extern float __wcstof_internal (const wchar_t *__restrict __nptr, |
9b2e9577 UD |
83 | wchar_t **__restrict __endptr, int __group) |
84 | __THROW; | |
a784e502 | 85 | extern long double __wcstold_internal (const wchar_t *__restrict __nptr, |
9b2e9577 UD |
86 | wchar_t **__restrict __endptr, |
87 | int __group) __THROW; | |
a784e502 | 88 | extern long int __wcstol_internal (const wchar_t *__restrict __nptr, |
9b2e9577 UD |
89 | wchar_t **__restrict __endptr, |
90 | int __base, int __group) __THROW; | |
a784e502 | 91 | extern unsigned long int __wcstoul_internal (const wchar_t *__restrict __npt, |
9b2e9577 UD |
92 | wchar_t **__restrict __endptr, |
93 | int __base, int __group) __THROW; | |
94 | __extension__ | |
a784e502 | 95 | extern long long int __wcstoll_internal (const wchar_t *__restrict __nptr, |
9b2e9577 UD |
96 | wchar_t **__restrict __endptr, |
97 | int __base, int __group) __THROW; | |
98 | __extension__ | |
a784e502 | 99 | extern unsigned long long int __wcstoull_internal (const wchar_t * |
9b2e9577 UD |
100 | __restrict __nptr, |
101 | wchar_t ** | |
102 | __restrict __endptr, | |
103 | int __base, | |
104 | int __group) __THROW; | |
e02cabec JM |
105 | extern unsigned long long int ____wcstoull_l_internal (const wchar_t *, |
106 | wchar_t **, int, int, | |
64924422 | 107 | bool, locale_t); |
509d1b68 RM |
108 | libc_hidden_proto (__wcstof_internal) |
109 | libc_hidden_proto (__wcstod_internal) | |
110 | libc_hidden_proto (__wcstold_internal) | |
111 | libc_hidden_proto (__wcstol_internal) | |
112 | libc_hidden_proto (__wcstoll_internal) | |
113 | libc_hidden_proto (__wcstoul_internal) | |
114 | libc_hidden_proto (__wcstoull_internal) | |
773e305e RM |
115 | libc_hidden_proto (wcstof) |
116 | libc_hidden_proto (wcstod) | |
45ae17dd | 117 | libc_hidden_ldbl_proto (wcstold) |
773e305e RM |
118 | libc_hidden_proto (wcstol) |
119 | libc_hidden_proto (wcstoll) | |
120 | libc_hidden_proto (wcstoul) | |
121 | libc_hidden_proto (wcstoull) | |
509d1b68 | 122 | |
c26dd7c6 L |
123 | extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int, |
124 | locale_t) attribute_hidden; | |
125 | extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int, | |
126 | locale_t) attribute_hidden; | |
127 | extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, | |
128 | int, locale_t) attribute_hidden; | |
129 | extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int, | |
64924422 | 130 | int, bool, locale_t) attribute_hidden; |
c26dd7c6 L |
131 | extern unsigned long int ____wcstoul_l_internal (const wchar_t *, |
132 | wchar_t **, | |
64924422 | 133 | int, int, bool, locale_t) |
c26dd7c6 L |
134 | attribute_hidden; |
135 | extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **, | |
64924422 | 136 | int, int, bool, locale_t) |
c26dd7c6 L |
137 | attribute_hidden; |
138 | extern unsigned long long int ____wcstoull_l_internal (const wchar_t *, | |
139 | wchar_t **, int, int, | |
64924422 | 140 | bool, locale_t) |
c26dd7c6 L |
141 | attribute_hidden; |
142 | ||
45f39d45 PM |
143 | #if __HAVE_DISTINCT_FLOAT128 |
144 | extern __typeof (wcstof128_l) __wcstof128_l; | |
145 | libc_hidden_proto (__wcstof128_l) | |
146 | extern _Float128 __wcstof128_internal (const wchar_t *__restrict __nptr, | |
147 | wchar_t **__restrict __endptr, | |
148 | int __group) __THROW; | |
149 | ||
c26dd7c6 L |
150 | extern _Float128 ____wcstof128_l_internal (const wchar_t *, wchar_t **, int, |
151 | locale_t) attribute_hidden; | |
152 | ||
45f39d45 PM |
153 | libc_hidden_proto (__wcstof128_internal) |
154 | libc_hidden_proto (wcstof128) | |
155 | #endif | |
156 | ||
509d1b68 RM |
157 | libc_hidden_proto (__wcscasecmp_l) |
158 | libc_hidden_proto (__wcsncasecmp_l) | |
159 | ||
ccadf7b5 UD |
160 | libc_hidden_proto (__wcscoll_l) |
161 | libc_hidden_proto (__wcsxfrm_l) | |
162 | ||
3ba06713 UD |
163 | libc_hidden_proto (fputws_unlocked) |
164 | libc_hidden_proto (putwc_unlocked) | |
b9b91868 | 165 | libc_hidden_proto (putwc) |
3ba06713 | 166 | |
9b0b40d3 | 167 | libc_hidden_proto (mbrtowc) |
8784cc18 | 168 | libc_hidden_proto (wcrtomb) |
64f98575 FB |
169 | libc_hidden_proto (__wcrtomb_chk) |
170 | ||
2f44ee08 JM |
171 | extern int __wcscmp (const wchar_t *__s1, const wchar_t *__s2) |
172 | __THROW __attribute_pure__; | |
173 | libc_hidden_proto (__wcscmp) | |
8784cc18 RM |
174 | libc_hidden_proto (wcsftime) |
175 | libc_hidden_proto (wcsspn) | |
176 | libc_hidden_proto (wcschr) | |
2cfbdb9a JM |
177 | /* The C++ overloading of wcschr means we have to repeat the type to |
178 | declare __wcschr instead of using typeof, to avoid errors in C++ | |
2f44ee08 JM |
179 | tests; in addition, __THROW cannot be used with a function type |
180 | from typeof in C++. The same applies to __wmemchr and, as regards | |
181 | __THROW, to __wcscmp and __wcscoll. */ | |
2cfbdb9a JM |
182 | extern wchar_t *__wcschr (const wchar_t *__wcs, wchar_t __wc) |
183 | __THROW __attribute_pure__; | |
184 | libc_hidden_proto (__wcschr) | |
2f44ee08 JM |
185 | extern int __wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW; |
186 | libc_hidden_proto (__wcscoll) | |
8784cc18 | 187 | libc_hidden_proto (wcspbrk) |
509d1b68 | 188 | |
6b4a158e | 189 | extern __typeof (wmemset) __wmemset; |
aca6ea65 JM |
190 | extern wchar_t *__wmemchr (const wchar_t *__s, wchar_t __c, size_t __n) |
191 | __THROW __attribute_pure__; | |
9b0b40d3 | 192 | libc_hidden_proto (wmemchr) |
aca6ea65 | 193 | libc_hidden_proto (__wmemchr) |
9b0b40d3 | 194 | libc_hidden_proto (wmemset) |
01cad84e | 195 | libc_hidden_proto (__wmemset) |
65f7767a AS |
196 | extern int __wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) |
197 | __THROW __attribute_pure__; | |
9b0b40d3 | 198 | |
bdbf022d | 199 | /* Now define the internal interfaces. */ |
a784e502 | 200 | extern int __wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) |
fb4dfa0c | 201 | __attribute_pure__; |
a784e502 | 202 | extern int __wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2, |
fb4dfa0c AJ |
203 | size_t __n) |
204 | __attribute_pure__; | |
a784e502 UD |
205 | extern size_t __wcslen (const wchar_t *__s) __attribute_pure__; |
206 | extern size_t __wcsnlen (const wchar_t *__s, size_t __maxlen) | |
80eb52e3 SL |
207 | __attribute_pure__; |
208 | extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src); | |
b54e5d1c FW |
209 | extern __typeof (wcslcat) __wcslcat; |
210 | libc_hidden_proto (__wcslcat) | |
44af8a32 | 211 | extern wint_t __btowc (int __c) attribute_hidden; |
a784e502 | 212 | extern int __mbsinit (const __mbstate_t *__ps); |
fe559c5e | 213 | extern size_t __mbrtowc (wchar_t *__restrict __pwc, |
a784e502 | 214 | const char *__restrict __s, size_t __n, |
c19559b0 | 215 | __mbstate_t *__restrict __p); |
37ba7d66 UD |
216 | libc_hidden_proto (__mbrtowc) |
217 | libc_hidden_proto (__mbrlen) | |
fe559c5e | 218 | extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc, |
44af8a32 | 219 | __mbstate_t *__restrict __ps) attribute_hidden; |
9bcd12d2 SP |
220 | extern size_t __wcrtomb_internal (char *__restrict __s, wchar_t __wc, |
221 | __mbstate_t *__restrict __ps, | |
222 | size_t __s_size) | |
223 | attribute_hidden; | |
fe559c5e | 224 | extern size_t __mbsrtowcs (wchar_t *__restrict __dst, |
a784e502 | 225 | const char **__restrict __src, |
44af8a32 L |
226 | size_t __len, __mbstate_t *__restrict __ps) |
227 | attribute_hidden; | |
fe559c5e | 228 | extern size_t __wcsrtombs (char *__restrict __dst, |
a784e502 | 229 | const wchar_t **__restrict __src, |
44af8a32 L |
230 | size_t __len, __mbstate_t *__restrict __ps) |
231 | attribute_hidden; | |
fe559c5e | 232 | extern size_t __mbsnrtowcs (wchar_t *__restrict __dst, |
a784e502 | 233 | const char **__restrict __src, size_t __nmc, |
44af8a32 L |
234 | size_t __len, __mbstate_t *__restrict __ps) |
235 | attribute_hidden; | |
fe559c5e | 236 | extern size_t __wcsnrtombs (char *__restrict __dst, |
a784e502 | 237 | const wchar_t **__restrict __src, |
fe559c5e | 238 | size_t __nwc, size_t __len, |
44af8a32 L |
239 | __mbstate_t *__restrict __ps) |
240 | attribute_hidden; | |
81a14439 AZ |
241 | extern wchar_t *__wcscpy (wchar_t *__restrict __dest, |
242 | const wchar_t *__restrict __src) | |
243 | attribute_hidden __nonnull ((1, 2)); | |
244 | libc_hidden_proto (__wcscpy) | |
b54e5d1c FW |
245 | extern __typeof (wcslcpy) __wcslcpy; |
246 | libc_hidden_proto (__wcslcpy) | |
8215c9ec | 247 | extern wchar_t *__wcsncpy (wchar_t *__restrict __dest, |
80eb52e3 | 248 | const wchar_t *__restrict __src, size_t __n); |
b54e5d1c | 249 | |
a784e502 UD |
250 | extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src); |
251 | extern wchar_t *__wcpncpy (wchar_t *__dest, const wchar_t *__src, | |
80eb52e3 | 252 | size_t __n); |
a784e502 | 253 | extern wchar_t *__wmemcpy (wchar_t *__s1, const wchar_t *s2, |
44af8a32 | 254 | size_t __n) attribute_hidden; |
fe559c5e | 255 | extern wchar_t *__wmempcpy (wchar_t *__restrict __s1, |
a784e502 | 256 | const wchar_t *__restrict __s2, |
44af8a32 | 257 | size_t __n) attribute_hidden; |
a784e502 | 258 | extern wchar_t *__wmemmove (wchar_t *__s1, const wchar_t *__s2, |
44af8a32 | 259 | size_t __n) attribute_hidden; |
a784e502 | 260 | extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc) |
80eb52e3 | 261 | __attribute_pure__; |
d64b6ad0 | 262 | |
ef9c4cb6 L |
263 | extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n, |
264 | size_t __ns) __THROW; | |
64f98575 | 265 | libc_hidden_builtin_proto (__wmemset_chk) |
ef9c4cb6 | 266 | |
d1646309 | 267 | extern int __vfwscanf (__FILE *__restrict __s, |
a784e502 | 268 | const wchar_t *__restrict __format, |
c19559b0 | 269 | __gnuc_va_list __arg) |
44af8a32 | 270 | attribute_hidden |
c19559b0 | 271 | /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */; |
64f98575 FB |
272 | |
273 | extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n, | |
274 | int __flag, size_t __s_len, | |
275 | const wchar_t *__restrict __format, ...) | |
276 | __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */; | |
277 | ||
51028f34 | 278 | extern int __fwprintf (__FILE *__restrict __s, |
a784e502 | 279 | const wchar_t *__restrict __format, ...) |
44af8a32 | 280 | attribute_hidden |
c6251f03 | 281 | /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; |
64f98575 FB |
282 | extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format, |
283 | ...); | |
c6251f03 RM |
284 | extern int __vfwprintf_chk (FILE *__restrict __s, int __flag, |
285 | const wchar_t *__restrict __format, | |
286 | __gnuc_va_list __arg) | |
51028f34 | 287 | /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; |
8215c9ec UD |
288 | extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n, |
289 | int __flag, size_t __s_len, | |
a784e502 | 290 | const wchar_t *__restrict __format, |
8215c9ec UD |
291 | __gnuc_va_list __arg) |
292 | /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */; | |
64f98575 FB |
293 | extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag, |
294 | const wchar_t *__restrict __format, ...); | |
295 | extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format, | |
296 | __gnuc_va_list __ap); | |
8215c9ec | 297 | |
874aa523 | 298 | extern int __isoc99_fwscanf (__FILE *__restrict __stream, |
a784e502 UD |
299 | const wchar_t *__restrict __format, ...); |
300 | extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...); | |
301 | extern int __isoc99_swscanf (const wchar_t *__restrict __s, | |
302 | const wchar_t *__restrict __format, ...) | |
874aa523 UD |
303 | __THROW; |
304 | extern int __isoc99_vfwscanf (__FILE *__restrict __s, | |
a784e502 | 305 | const wchar_t *__restrict __format, |
874aa523 | 306 | __gnuc_va_list __arg); |
a784e502 | 307 | extern int __isoc99_vwscanf (const wchar_t *__restrict __format, |
874aa523 | 308 | __gnuc_va_list __arg); |
a784e502 UD |
309 | extern int __isoc99_vswscanf (const wchar_t *__restrict __s, |
310 | const wchar_t *__restrict __format, | |
874aa523 | 311 | __gnuc_va_list __arg) __THROW; |
dee2bea0 JM |
312 | extern int __isoc23_fwscanf (__FILE *__restrict __stream, |
313 | const wchar_t *__restrict __format, ...); | |
314 | extern int __isoc23_wscanf (const wchar_t *__restrict __format, ...); | |
315 | extern int __isoc23_swscanf (const wchar_t *__restrict __s, | |
316 | const wchar_t *__restrict __format, ...) | |
317 | __THROW; | |
318 | extern int __isoc23_vfwscanf (__FILE *__restrict __s, | |
319 | const wchar_t *__restrict __format, | |
320 | __gnuc_va_list __arg); | |
321 | extern int __isoc23_vwscanf (const wchar_t *__restrict __format, | |
322 | __gnuc_va_list __arg); | |
323 | extern int __isoc23_vswscanf (const wchar_t *__restrict __s, | |
324 | const wchar_t *__restrict __format, | |
325 | __gnuc_va_list __arg) __THROW; | |
874aa523 UD |
326 | libc_hidden_proto (__isoc99_vswscanf) |
327 | libc_hidden_proto (__isoc99_vfwscanf) | |
dee2bea0 JM |
328 | libc_hidden_proto (__isoc23_vswscanf) |
329 | libc_hidden_proto (__isoc23_vfwscanf) | |
874aa523 | 330 | |
01beb5b9 UD |
331 | /* Internal functions. */ |
332 | extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len, | |
af85385f | 333 | mbstate_t *ps, locale_t l) attribute_hidden; |
2def8764 UD |
334 | |
335 | /* Special version. We know that all uses of mbsinit inside the libc | |
336 | have a non-NULL parameter. And certainly we can access the | |
337 | internals of the data structure directly. */ | |
338 | # define mbsinit(state) ((state)->__count == 0) | |
339 | # define __mbsinit(state) ((state)->__count == 0) | |
340 | ||
d64b6ad0 | 341 | # endif |
6796bc80 | 342 | #endif |