Use binutils 2.41 branch in build-many-glibcs.py
[glibc.git] / include / stdlib.h
blobd1d00c0f6f262df3b2f0354f70f726123f821a1a
1 #ifndef _STDLIB_H
3 #ifndef _ISOMAC
4 # include <stdbool.h>
5 # include <stddef.h>
6 #endif
8 /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */
9 #include <bits/floatn.h>
10 #if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
11 # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
12 # pragma GCC system_header
13 # endif
14 #endif
16 #include <stdlib/stdlib.h>
18 /* Now define the internal interfaces. */
19 #if !defined _ISOMAC
20 # include <sys/stat.h>
22 # include <rtld-malloc.h>
24 extern __typeof (strtol_l) __strtol_l;
25 extern __typeof (strtoul_l) __strtoul_l;
26 extern __typeof (strtoll_l) __strtoll_l;
27 extern __typeof (strtoull_l) __strtoull_l;
28 extern __typeof (strtod_l) __strtod_l;
29 extern __typeof (strtof_l) __strtof_l;
30 extern __typeof (strtold_l) __strtold_l;
31 libc_hidden_proto (__strtol_l)
32 libc_hidden_proto (__strtoul_l)
33 libc_hidden_proto (__strtoll_l)
34 libc_hidden_proto (__strtoull_l)
35 libc_hidden_proto (__strtod_l)
36 libc_hidden_proto (__strtof_l)
37 libc_hidden_proto (__strtold_l)
39 extern __typeof (strtol) __isoc23_strtol __attribute_copy__ (strtol);
40 extern __typeof (strtoul) __isoc23_strtoul __attribute_copy__ (strtoul);
41 extern __typeof (strtoll) __isoc23_strtoll __attribute_copy__ (strtoll);
42 extern __typeof (strtoull) __isoc23_strtoull __attribute_copy__ (strtoull);
43 extern __typeof (strtol_l) __isoc23_strtol_l __attribute_copy__ (strtol_l);
44 extern __typeof (strtoul_l) __isoc23_strtoul_l __attribute_copy__ (strtoul_l);
45 extern __typeof (strtoll_l) __isoc23_strtoll_l __attribute_copy__ (strtoll_l);
46 extern __typeof (strtoull_l) __isoc23_strtoull_l __attribute_copy__ (strtoull_l);
47 libc_hidden_proto (__isoc23_strtol)
48 libc_hidden_proto (__isoc23_strtoul)
49 libc_hidden_proto (__isoc23_strtoll)
50 libc_hidden_proto (__isoc23_strtoull)
51 libc_hidden_proto (__isoc23_strtol_l)
52 libc_hidden_proto (__isoc23_strtoul_l)
53 libc_hidden_proto (__isoc23_strtoll_l)
54 libc_hidden_proto (__isoc23_strtoull_l)
56 #if __GLIBC_USE (C2X_STRTOL)
57 /* Redirect internal uses of these functions to the C2X versions; the
58 redirection in the installed header does not work with
59 libc_hidden_proto. */
60 # undef strtol
61 # define strtol __isoc23_strtol
62 # undef atoi
63 # define atoi(nptr) __isoc23_strtol(nptr, NULL, 10)
64 # undef strtoul
65 # define strtoul __isoc23_strtoul
66 # undef strtoll
67 # define strtoll __isoc23_strtoll
68 # undef strtoull
69 # define strtoull __isoc23_strtoull
70 # undef strtol_l
71 # define strtol_l __isoc23_strtol_l
72 # undef strtoul_l
73 # define strtoul_l __isoc23_strtoul_l
74 # undef strtoll_l
75 # define strtoll_l __isoc23_strtoll_l
76 # undef strtoull_l
77 # define strtoull_l __isoc23_strtoull_l
78 #endif
80 libc_hidden_proto (exit)
81 libc_hidden_proto (abort)
82 libc_hidden_proto (getenv)
83 extern __typeof (secure_getenv) __libc_secure_getenv;
84 libc_hidden_proto (__libc_secure_getenv)
85 libc_hidden_proto (bsearch)
86 libc_hidden_proto (qsort)
87 extern __typeof (qsort_r) __qsort_r;
88 libc_hidden_proto (__qsort_r)
89 libc_hidden_proto (lrand48_r)
90 libc_hidden_proto (wctomb)
92 extern long int __random (void) attribute_hidden;
93 extern void __srandom (unsigned int __seed);
94 extern char *__initstate (unsigned int __seed, char *__statebuf,
95 size_t __statelen);
96 extern char *__setstate (char *__statebuf);
97 extern int __random_r (struct random_data *__buf, int32_t *__result)
98 attribute_hidden;
99 extern int __srandom_r (unsigned int __seed, struct random_data *__buf)
100 attribute_hidden;
101 extern int __initstate_r (unsigned int __seed, char *__statebuf,
102 size_t __statelen, struct random_data *__buf)
103 attribute_hidden;
104 extern int __setstate_r (char *__statebuf, struct random_data *__buf)
105 attribute_hidden;
106 extern int __rand_r (unsigned int *__seed);
107 extern int __erand48_r (unsigned short int __xsubi[3],
108 struct drand48_data *__buffer, double *__result)
109 attribute_hidden;
110 extern int __nrand48_r (unsigned short int __xsubi[3],
111 struct drand48_data *__buffer,
112 long int *__result) attribute_hidden;
113 extern int __jrand48_r (unsigned short int __xsubi[3],
114 struct drand48_data *__buffer,
115 long int *__result) attribute_hidden;
116 extern int __srand48_r (long int __seedval,
117 struct drand48_data *__buffer) attribute_hidden;
118 extern int __seed48_r (unsigned short int __seed16v[3],
119 struct drand48_data *__buffer) attribute_hidden;
120 extern int __lcong48_r (unsigned short int __param[7],
121 struct drand48_data *__buffer) attribute_hidden;
123 /* Internal function to compute next state of the generator. */
124 extern int __drand48_iterate (unsigned short int __xsubi[3],
125 struct drand48_data *__buffer)
126 attribute_hidden;
128 /* Global state for non-reentrant functions. Defined in drand48-iter.c. */
129 extern struct drand48_data __libc_drand48_data attribute_hidden;
131 extern int __setenv (const char *__name, const char *__value, int __replace)
132 attribute_hidden;
133 extern int __unsetenv (const char *__name) attribute_hidden;
134 extern int __clearenv (void) attribute_hidden;
135 extern char *__mktemp (char *__template) __THROW __nonnull ((1));
136 libc_hidden_proto (__mktemp)
137 extern char *__canonicalize_file_name (const char *__name);
138 extern char *__realpath (const char *__name, char *__resolved);
139 libc_hidden_proto (__realpath)
140 extern int __ptsname_r (int __fd, char *__buf, size_t __buflen)
141 attribute_hidden;
142 # ifndef _ISOMAC
143 extern int __ptsname_internal (int fd, char *buf, size_t buflen,
144 struct stat64 *stp) attribute_hidden;
145 # endif
146 extern int __getpt (void);
147 extern int __posix_openpt (int __oflag) attribute_hidden;
149 extern int __add_to_environ (const char *name, const char *value,
150 const char *combines, int replace)
151 attribute_hidden;
152 extern void _quicksort (void *const pbase, size_t total_elems,
153 size_t size, __compar_d_fn_t cmp, void *arg);
155 extern int __on_exit (void (*__func) (int __status, void *__arg), void *__arg);
157 extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
158 libc_hidden_proto (__cxa_atexit);
160 extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg,
161 void *d);
162 extern void __call_tls_dtors (void)
163 #ifndef SHARED
164 __attribute__ ((weak))
165 #endif
167 libc_hidden_proto (__call_tls_dtors)
169 extern void __cxa_finalize (void *d);
171 extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
173 extern void *__libc_memalign (size_t alignment, size_t size)
174 __attribute_malloc__;
176 extern void *__libc_reallocarray (void *__ptr, size_t __nmemb, size_t __size)
177 __THROW __attribute_warn_unused_result__;
178 libc_hidden_proto (__libc_reallocarray)
180 extern int __libc_system (const char *line);
182 extern __typeof (getpt) __getpt;
183 extern __typeof (ptsname_r) __ptsname_r;
184 libc_hidden_proto (__getpt)
185 libc_hidden_proto (__ptsname_r)
186 libc_hidden_proto (grantpt)
187 libc_hidden_proto (unlockpt)
189 __typeof (arc4random) __arc4random;
190 libc_hidden_proto (__arc4random);
191 __typeof (arc4random_buf) __arc4random_buf;
192 libc_hidden_proto (__arc4random_buf);
193 __typeof (arc4random_uniform) __arc4random_uniform;
194 libc_hidden_proto (__arc4random_uniform);
195 extern void __arc4random_buf_internal (void *buffer, size_t len)
196 attribute_hidden;
198 extern double __strtod_internal (const char *__restrict __nptr,
199 char **__restrict __endptr, int __group)
200 __THROW __nonnull ((1)) __wur;
201 extern float __strtof_internal (const char *__restrict __nptr,
202 char **__restrict __endptr, int __group)
203 __THROW __nonnull ((1)) __wur;
204 extern long double __strtold_internal (const char *__restrict __nptr,
205 char **__restrict __endptr,
206 int __group)
207 __THROW __nonnull ((1)) __wur;
208 extern long int __strtol_internal (const char *__restrict __nptr,
209 char **__restrict __endptr,
210 int __base, int __group)
211 __THROW __nonnull ((1)) __wur;
212 extern unsigned long int __strtoul_internal (const char *__restrict __nptr,
213 char **__restrict __endptr,
214 int __base, int __group)
215 __THROW __nonnull ((1)) __wur;
216 __extension__
217 extern long long int __strtoll_internal (const char *__restrict __nptr,
218 char **__restrict __endptr,
219 int __base, int __group)
220 __THROW __nonnull ((1)) __wur;
221 __extension__
222 extern unsigned long long int __strtoull_internal (const char *
223 __restrict __nptr,
224 char **__restrict __endptr,
225 int __base, int __group)
226 __THROW __nonnull ((1)) __wur;
227 libc_hidden_proto (__strtof_internal)
228 libc_hidden_proto (__strtod_internal)
229 libc_hidden_proto (__strtold_internal)
230 libc_hidden_proto (__strtol_internal)
231 libc_hidden_proto (__strtoll_internal)
232 libc_hidden_proto (__strtoul_internal)
233 libc_hidden_proto (__strtoull_internal)
235 extern double ____strtod_l_internal (const char *__restrict __nptr,
236 char **__restrict __endptr, int __group,
237 locale_t __loc);
238 extern float ____strtof_l_internal (const char *__restrict __nptr,
239 char **__restrict __endptr, int __group,
240 locale_t __loc);
241 extern long double ____strtold_l_internal (const char *__restrict __nptr,
242 char **__restrict __endptr,
243 int __group, locale_t __loc);
244 extern long int ____strtol_l_internal (const char *__restrict __nptr,
245 char **__restrict __endptr,
246 int __base, int __group,
247 bool __bin_cst, locale_t __loc);
248 extern unsigned long int ____strtoul_l_internal (const char *
249 __restrict __nptr,
250 char **__restrict __endptr,
251 int __base, int __group,
252 bool __bin_cst,
253 locale_t __loc);
254 __extension__
255 extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
256 char **__restrict __endptr,
257 int __base, int __group,
258 bool __bin_cst, locale_t __loc);
259 __extension__
260 extern unsigned long long int ____strtoull_l_internal (const char *
261 __restrict __nptr,
262 char **
263 __restrict __endptr,
264 int __base, int __group,
265 bool __bin_cst,
266 locale_t __loc);
268 libc_hidden_proto (____strtof_l_internal)
269 libc_hidden_proto (____strtod_l_internal)
270 libc_hidden_proto (____strtold_l_internal)
271 libc_hidden_proto (____strtol_l_internal)
272 libc_hidden_proto (____strtoll_l_internal)
273 libc_hidden_proto (____strtoul_l_internal)
274 libc_hidden_proto (____strtoull_l_internal)
276 #include <bits/floatn.h>
277 libc_hidden_proto (strtof)
278 libc_hidden_proto (strtod)
279 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
280 libc_hidden_proto (strtold)
281 #endif
282 libc_hidden_proto (strtol)
283 libc_hidden_proto (strtoll)
284 libc_hidden_proto (strtoul)
285 libc_hidden_proto (strtoull)
287 libc_hidden_proto (atoi)
289 extern float __strtof_nan (const char *, char **, char);
290 extern double __strtod_nan (const char *, char **, char);
291 extern long double __strtold_nan (const char *, char **, char);
292 extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t);
293 extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t);
294 extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t);
296 libc_hidden_proto (__strtof_nan)
297 libc_hidden_proto (__strtod_nan)
298 libc_hidden_proto (__strtold_nan)
299 libc_hidden_proto (__wcstof_nan)
300 libc_hidden_proto (__wcstod_nan)
301 libc_hidden_proto (__wcstold_nan)
303 /* Enable _FloatN bits as needed. */
304 #include <bits/floatn.h>
306 #if __HAVE_DISTINCT_FLOAT128
307 extern __typeof (strtof128_l) __strtof128_l;
309 libc_hidden_proto (__strtof128_l)
310 libc_hidden_proto (strtof128)
312 extern _Float128 __strtof128_nan (const char *, char **, char);
313 extern _Float128 __wcstof128_nan (const wchar_t *, wchar_t **, wchar_t);
315 libc_hidden_proto (__strtof128_nan)
316 libc_hidden_proto (__wcstof128_nan)
318 extern _Float128 __strtof128_internal (const char *__restrict __nptr,
319 char **__restrict __endptr,
320 int __group);
321 libc_hidden_proto (__strtof128_internal)
323 extern _Float128 ____strtof128_l_internal (const char *__restrict __nptr,
324 char **__restrict __endptr,
325 int __group, locale_t __loc);
327 libc_hidden_proto (____strtof128_l_internal)
328 #endif
330 extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
331 int *__restrict __sign);
332 extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
333 int *__restrict __sign);
334 extern char *__gcvt (double __value, int __ndigit, char *__buf);
335 extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
336 int *__restrict __sign, char *__restrict __buf,
337 size_t __len);
338 libc_hidden_proto (__ecvt_r)
339 extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
340 int *__restrict __sign, char *__restrict __buf,
341 size_t __len);
342 libc_hidden_proto (__fcvt_r)
343 extern char *__qecvt (long double __value, int __ndigit,
344 int *__restrict __decpt, int *__restrict __sign);
345 extern char *__qfcvt (long double __value, int __ndigit,
346 int *__restrict __decpt, int *__restrict __sign);
347 extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
348 extern int __qecvt_r (long double __value, int __ndigit,
349 int *__restrict __decpt, int *__restrict __sign,
350 char *__restrict __buf, size_t __len);
351 libc_hidden_proto (__qecvt_r)
352 extern int __qfcvt_r (long double __value, int __ndigit,
353 int *__restrict __decpt, int *__restrict __sign,
354 char *__restrict __buf, size_t __len);
355 libc_hidden_proto (__qfcvt_r)
357 # if IS_IN (libc)
358 # undef MB_CUR_MAX
359 # define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))
360 # endif
362 struct abort_msg_s
364 unsigned int size;
365 char msg[0];
367 extern struct abort_msg_s *__abort_msg;
368 libc_hidden_proto (__abort_msg)
370 # if IS_IN (rtld)
371 extern __typeof (unsetenv) unsetenv attribute_hidden;
372 extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
373 # endif
375 #endif
377 #endif /* include/stdlib.h */