2 //===--------------------------- stdlib.h ---------------------------------===//
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
8 //===----------------------------------------------------------------------===//
10 #if defined(__need_malloc_and_calloc) || defined(_LIBCPP_STDLIB_INCLUDE_NEXT)
12 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
13 #pragma GCC system_header
16 #if defined(_LIBCPP_STDLIB_INCLUDE_NEXT)
17 #undef _LIBCPP_STDLIB_INCLUDE_NEXT
20 #include_next <stdlib.h>
22 #elif !defined(_LIBCPP_STDLIB_H)
23 #define _LIBCPP_STDLIB_H
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
55 void srand(unsigned int seed);
56 void* calloc(size_t nmemb, size_t size);
58 void* malloc(size_t size);
59 void* realloc(void* ptr, size_t size);
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 *));
72 long long abs(long long j); // C++0X
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
93 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
94 #pragma GCC system_header
97 #include_next <stdlib.h>
101 #endif // __cplusplus
103 #endif // _LIBCPP_STDLIB_H