1 | // -*- C++ -*- |
2 | //===--------------------------- stdlib.h ---------------------------------===// |
3 | // |
4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
5 | // See https://llvm.org/LICENSE.txt for license information. |
6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
7 | // |
8 | //===----------------------------------------------------------------------===// |
9 | |
10 | #if defined(__need_malloc_and_calloc) || defined(_LIBCPP_STDLIB_INCLUDE_NEXT) |
11 | |
12 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
13 | #pragma GCC system_header |
14 | #endif |
15 | |
16 | #if defined(_LIBCPP_STDLIB_INCLUDE_NEXT) |
17 | #undef _LIBCPP_STDLIB_INCLUDE_NEXT |
18 | #endif |
19 | |
20 | #include_next <stdlib.h> |
21 | |
22 | #elif !defined(_LIBCPP_STDLIB_H) |
23 | #define _LIBCPP_STDLIB_H |
24 | |
25 | /* |
26 | stdlib.h synopsis |
27 | |
28 | Macros: |
29 | |
30 | EXIT_FAILURE |
31 | EXIT_SUCCESS |
32 | MB_CUR_MAX |
33 | NULL |
34 | RAND_MAX |
35 | |
36 | Types: |
37 | |
38 | size_t |
39 | div_t |
40 | ldiv_t |
41 | lldiv_t // C99 |
42 | |
43 | double atof (const char* nptr); |
44 | int atoi (const char* nptr); |
45 | long atol (const char* nptr); |
46 | long long atoll(const char* nptr); // C99 |
47 | double strtod (const char* restrict nptr, char** restrict endptr); |
48 | float strtof (const char* restrict nptr, char** restrict endptr); // C99 |
49 | long double strtold (const char* restrict nptr, char** restrict endptr); // C99 |
50 | long strtol (const char* restrict nptr, char** restrict endptr, int base); |
51 | long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99 |
52 | unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base); |
53 | unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99 |
54 | int rand(void); |
55 | void srand(unsigned int seed); |
56 | void* calloc(size_t nmemb, size_t size); |
57 | void free(void* ptr); |
58 | void* malloc(size_t size); |
59 | void* realloc(void* ptr, size_t size); |
60 | void abort(void); |
61 | int atexit(void (*func)(void)); |
62 | void exit(int status); |
63 | void _Exit(int status); |
64 | char* getenv(const char* name); |
65 | int system(const char* string); |
66 | void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, |
67 | int (*compar)(const void *, const void *)); |
68 | void qsort(void* base, size_t nmemb, size_t size, |
69 | int (*compar)(const void *, const void *)); |
70 | int abs( int j); |
71 | long abs( long j); |
72 | long long abs(long long j); // C++0X |
73 | long labs( long j); |
74 | long long llabs(long long j); // C99 |
75 | div_t div( int numer, int denom); |
76 | ldiv_t div( long numer, long denom); |
77 | lldiv_t div(long long numer, long long denom); // C++0X |
78 | ldiv_t ldiv( long numer, long denom); |
79 | lldiv_t lldiv(long long numer, long long denom); // C99 |
80 | int mblen(const char* s, size_t n); |
81 | int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); |
82 | int wctomb(char* s, wchar_t wchar); |
83 | size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); |
84 | size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); |
85 | int at_quick_exit(void (*func)(void)) // C++11 |
86 | void quick_exit(int status); // C++11 |
87 | void *aligned_alloc(size_t alignment, size_t size); // C11 |
88 | |
89 | */ |
90 | |
91 | #include <__config> |
92 | |
93 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
94 | #pragma GCC system_header |
95 | #endif |
96 | |
97 | #include_next <stdlib.h> |
98 | |
99 | #ifdef __cplusplus |
100 | #include <math.h> |
101 | #endif // __cplusplus |
102 | |
103 | #endif // _LIBCPP_STDLIB_H |
104 | |