3 /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */
4 # include <bits/floatn.h>
5 # if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
6 # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
7 # pragma GCC system_header
11 # include <wcsmbs/wchar.h>
14 #include <bits/floatn.h>
17 extern __typeof (wcscasecmp_l
) __wcscasecmp_l
;
18 extern __typeof (wcsncasecmp_l
) __wcsncasecmp_l
;
19 extern __typeof (wcscoll_l
) __wcscoll_l
;
20 extern __typeof (wcsxfrm_l
) __wcsxfrm_l
;
21 extern __typeof (wcstol_l
) __wcstol_l
;
22 extern __typeof (wcstoul_l
) __wcstoul_l
;
23 extern __typeof (wcstoll_l
) __wcstoll_l
;
24 extern __typeof (wcstoull_l
) __wcstoull_l
;
25 extern __typeof (wcstod_l
) __wcstod_l
;
26 extern __typeof (wcstof_l
) __wcstof_l
;
27 extern __typeof (wcstold_l
) __wcstold_l
;
28 extern __typeof (wcsftime_l
) __wcsftime_l
;
29 libc_hidden_proto (__wcstol_l
)
30 libc_hidden_proto (__wcstoul_l
)
31 libc_hidden_proto (__wcstoll_l
)
32 libc_hidden_proto (__wcstoull_l
)
33 libc_hidden_proto (__wcstod_l
)
34 libc_hidden_proto (__wcstof_l
)
35 libc_hidden_proto (__wcstold_l
)
36 libc_hidden_proto (__wcsftime_l
)
38 extern __typeof (wcstol
) __isoc23_wcstol
__attribute_copy__ (wcstol
);
39 extern __typeof (wcstoul
) __isoc23_wcstoul
__attribute_copy__ (wcstoul
);
40 extern __typeof (wcstoll
) __isoc23_wcstoll
__attribute_copy__ (wcstoll
);
41 extern __typeof (wcstoull
) __isoc23_wcstoull
__attribute_copy__ (wcstoull
);
42 extern __typeof (wcstol_l
) __isoc23_wcstol_l
__attribute_copy__ (wcstol_l
);
43 extern __typeof (wcstoul_l
) __isoc23_wcstoul_l
__attribute_copy__ (wcstoul_l
);
44 extern __typeof (wcstoll_l
) __isoc23_wcstoll_l
__attribute_copy__ (wcstoll_l
);
45 extern __typeof (wcstoull_l
) __isoc23_wcstoull_l
__attribute_copy__ (wcstoull_l
);
46 libc_hidden_proto (__isoc23_wcstol
)
47 libc_hidden_proto (__isoc23_wcstoul
)
48 libc_hidden_proto (__isoc23_wcstoll
)
49 libc_hidden_proto (__isoc23_wcstoull
)
50 libc_hidden_proto (__isoc23_wcstol_l
)
51 libc_hidden_proto (__isoc23_wcstoul_l
)
52 libc_hidden_proto (__isoc23_wcstoll_l
)
53 libc_hidden_proto (__isoc23_wcstoull_l
)
55 #if __GLIBC_USE (C2X_STRTOL)
56 /* Redirect internal uses of these functions to the C2X versions; the
57 redirection in the installed header does not work with
60 # define wcstol __isoc23_wcstol
62 # define wcstoul __isoc23_wcstoul
64 # define wcstoll __isoc23_wcstoll
66 # define wcstoull __isoc23_wcstoull
68 # define wcstol_l __isoc23_wcstol_l
70 # define wcstoul_l __isoc23_wcstoul_l
72 # define wcstoll_l __isoc23_wcstoll_l
74 # define wcstoull_l __isoc23_wcstoull_l
78 extern double __wcstod_internal (const wchar_t *__restrict __nptr
,
79 wchar_t **__restrict __endptr
, int __group
)
81 extern float __wcstof_internal (const wchar_t *__restrict __nptr
,
82 wchar_t **__restrict __endptr
, int __group
)
84 extern long double __wcstold_internal (const wchar_t *__restrict __nptr
,
85 wchar_t **__restrict __endptr
,
87 extern long int __wcstol_internal (const wchar_t *__restrict __nptr
,
88 wchar_t **__restrict __endptr
,
89 int __base
, int __group
) __THROW
;
90 extern unsigned long int __wcstoul_internal (const wchar_t *__restrict __npt
,
91 wchar_t **__restrict __endptr
,
92 int __base
, int __group
) __THROW
;
94 extern long long int __wcstoll_internal (const wchar_t *__restrict __nptr
,
95 wchar_t **__restrict __endptr
,
96 int __base
, int __group
) __THROW
;
98 extern unsigned long long int __wcstoull_internal (const wchar_t *
103 int __group
) __THROW
;
104 extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
105 wchar_t **, int, int,
107 libc_hidden_proto (__wcstof_internal
)
108 libc_hidden_proto (__wcstod_internal
)
109 libc_hidden_proto (__wcstold_internal
)
110 libc_hidden_proto (__wcstol_internal
)
111 libc_hidden_proto (__wcstoll_internal
)
112 libc_hidden_proto (__wcstoul_internal
)
113 libc_hidden_proto (__wcstoull_internal
)
114 libc_hidden_proto (wcstof
)
115 libc_hidden_proto (wcstod
)
116 libc_hidden_ldbl_proto (wcstold
)
117 libc_hidden_proto (wcstol
)
118 libc_hidden_proto (wcstoll
)
119 libc_hidden_proto (wcstoul
)
120 libc_hidden_proto (wcstoull
)
122 extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
123 locale_t
) attribute_hidden
;
124 extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int,
125 locale_t
) attribute_hidden
;
126 extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **,
127 int, locale_t
) attribute_hidden
;
128 extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int,
129 int, bool, locale_t
) attribute_hidden
;
130 extern unsigned long int ____wcstoul_l_internal (const wchar_t *,
132 int, int, bool, locale_t
)
134 extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **,
135 int, int, bool, locale_t
)
137 extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
138 wchar_t **, int, int,
142 #if __HAVE_DISTINCT_FLOAT128
143 extern __typeof (wcstof128_l
) __wcstof128_l
;
144 libc_hidden_proto (__wcstof128_l
)
145 extern _Float128
__wcstof128_internal (const wchar_t *__restrict __nptr
,
146 wchar_t **__restrict __endptr
,
147 int __group
) __THROW
;
149 extern _Float128
____wcstof128_l_internal (const wchar_t *, wchar_t **, int,
150 locale_t
) attribute_hidden
;
152 libc_hidden_proto (__wcstof128_internal
)
153 libc_hidden_proto (wcstof128
)
156 libc_hidden_proto (__wcscasecmp_l
)
157 libc_hidden_proto (__wcsncasecmp_l
)
159 libc_hidden_proto (__wcscoll_l
)
160 libc_hidden_proto (__wcsxfrm_l
)
162 libc_hidden_proto (fputws_unlocked
)
163 libc_hidden_proto (putwc_unlocked
)
164 libc_hidden_proto (putwc
)
166 libc_hidden_proto (mbrtowc
)
167 libc_hidden_proto (wcrtomb
)
168 extern int __wcscmp (const wchar_t *__s1
, const wchar_t *__s2
)
169 __THROW __attribute_pure__
;
170 libc_hidden_proto (__wcscmp
)
171 libc_hidden_proto (wcsftime
)
172 libc_hidden_proto (wcsspn
)
173 libc_hidden_proto (wcschr
)
174 /* The C++ overloading of wcschr means we have to repeat the type to
175 declare __wcschr instead of using typeof, to avoid errors in C++
176 tests; in addition, __THROW cannot be used with a function type
177 from typeof in C++. The same applies to __wmemchr and, as regards
178 __THROW, to __wcscmp and __wcscoll. */
179 extern wchar_t *__wcschr (const wchar_t *__wcs
, wchar_t __wc
)
180 __THROW __attribute_pure__
;
181 libc_hidden_proto (__wcschr
)
182 extern int __wcscoll (const wchar_t *__s1
, const wchar_t *__s2
) __THROW
;
183 libc_hidden_proto (__wcscoll
)
184 libc_hidden_proto (wcspbrk
)
186 extern __typeof (wmemset
) __wmemset
;
187 extern wchar_t *__wmemchr (const wchar_t *__s
, wchar_t __c
, size_t __n
)
188 __THROW __attribute_pure__
;
189 libc_hidden_proto (wmemchr
)
190 libc_hidden_proto (__wmemchr
)
191 libc_hidden_proto (wmemset
)
192 libc_hidden_proto (__wmemset
)
193 extern int __wmemcmp (const wchar_t *__s1
, const wchar_t *__s2
, size_t __n
)
194 __THROW __attribute_pure__
;
196 /* Now define the internal interfaces. */
197 extern int __wcscasecmp (const wchar_t *__s1
, const wchar_t *__s2
)
199 extern int __wcsncasecmp (const wchar_t *__s1
, const wchar_t *__s2
,
202 extern size_t __wcslen (const wchar_t *__s
) __attribute_pure__
;
203 extern size_t __wcsnlen (const wchar_t *__s
, size_t __maxlen
)
205 extern wchar_t *__wcscat (wchar_t *dest
, const wchar_t *src
);
206 extern wint_t __btowc (int __c
) attribute_hidden
;
207 extern int __mbsinit (const __mbstate_t
*__ps
);
208 extern size_t __mbrtowc (wchar_t *__restrict __pwc
,
209 const char *__restrict __s
, size_t __n
,
210 __mbstate_t
*__restrict __p
);
211 libc_hidden_proto (__mbrtowc
)
212 libc_hidden_proto (__mbrlen
)
213 extern size_t __wcrtomb (char *__restrict __s
, wchar_t __wc
,
214 __mbstate_t
*__restrict __ps
) attribute_hidden
;
215 extern size_t __wcrtomb_internal (char *__restrict __s
, wchar_t __wc
,
216 __mbstate_t
*__restrict __ps
,
219 extern size_t __mbsrtowcs (wchar_t *__restrict __dst
,
220 const char **__restrict __src
,
221 size_t __len
, __mbstate_t
*__restrict __ps
)
223 extern size_t __wcsrtombs (char *__restrict __dst
,
224 const wchar_t **__restrict __src
,
225 size_t __len
, __mbstate_t
*__restrict __ps
)
227 extern size_t __mbsnrtowcs (wchar_t *__restrict __dst
,
228 const char **__restrict __src
, size_t __nmc
,
229 size_t __len
, __mbstate_t
*__restrict __ps
)
231 extern size_t __wcsnrtombs (char *__restrict __dst
,
232 const wchar_t **__restrict __src
,
233 size_t __nwc
, size_t __len
,
234 __mbstate_t
*__restrict __ps
)
236 extern wchar_t *__wcscpy (wchar_t *__restrict __dest
,
237 const wchar_t *__restrict __src
)
238 attribute_hidden
__nonnull ((1, 2));
239 libc_hidden_proto (__wcscpy
)
240 extern wchar_t *__wcsncpy (wchar_t *__restrict __dest
,
241 const wchar_t *__restrict __src
, size_t __n
);
242 extern wchar_t *__wcpcpy (wchar_t *__dest
, const wchar_t *__src
);
243 extern wchar_t *__wcpncpy (wchar_t *__dest
, const wchar_t *__src
,
245 extern wchar_t *__wmemcpy (wchar_t *__s1
, const wchar_t *s2
,
246 size_t __n
) attribute_hidden
;
247 extern wchar_t *__wmempcpy (wchar_t *__restrict __s1
,
248 const wchar_t *__restrict __s2
,
249 size_t __n
) attribute_hidden
;
250 extern wchar_t *__wmemmove (wchar_t *__s1
, const wchar_t *__s2
,
251 size_t __n
) attribute_hidden
;
252 extern wchar_t *__wcschrnul (const wchar_t *__s
, wchar_t __wc
)
255 extern wchar_t *__wmemset_chk (wchar_t *__s
, wchar_t __c
, size_t __n
,
256 size_t __ns
) __THROW
;
258 extern int __vfwscanf (__FILE
*__restrict __s
,
259 const wchar_t *__restrict __format
,
260 __gnuc_va_list __arg
)
262 /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */;
263 extern int __fwprintf (__FILE
*__restrict __s
,
264 const wchar_t *__restrict __format
, ...)
266 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
267 extern int __vfwprintf_chk (FILE *__restrict __s
, int __flag
,
268 const wchar_t *__restrict __format
,
269 __gnuc_va_list __arg
)
270 /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
271 extern int __vswprintf_chk (wchar_t *__restrict __s
, size_t __n
,
272 int __flag
, size_t __s_len
,
273 const wchar_t *__restrict __format
,
274 __gnuc_va_list __arg
)
275 /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
277 extern int __isoc99_fwscanf (__FILE
*__restrict __stream
,
278 const wchar_t *__restrict __format
, ...);
279 extern int __isoc99_wscanf (const wchar_t *__restrict __format
, ...);
280 extern int __isoc99_swscanf (const wchar_t *__restrict __s
,
281 const wchar_t *__restrict __format
, ...)
283 extern int __isoc99_vfwscanf (__FILE
*__restrict __s
,
284 const wchar_t *__restrict __format
,
285 __gnuc_va_list __arg
);
286 extern int __isoc99_vwscanf (const wchar_t *__restrict __format
,
287 __gnuc_va_list __arg
);
288 extern int __isoc99_vswscanf (const wchar_t *__restrict __s
,
289 const wchar_t *__restrict __format
,
290 __gnuc_va_list __arg
) __THROW
;
291 libc_hidden_proto (__isoc99_vswscanf
)
292 libc_hidden_proto (__isoc99_vfwscanf
)
294 /* Internal functions. */
295 extern size_t __mbsrtowcs_l (wchar_t *dst
, const char **src
, size_t len
,
296 mbstate_t *ps
, locale_t l
) attribute_hidden
;
298 /* Special version. We know that all uses of mbsinit inside the libc
299 have a non-NULL parameter. And certainly we can access the
300 internals of the data structure directly. */
301 # define mbsinit(state) ((state)->__count == 0)
302 # define __mbsinit(state) ((state)->__count == 0)