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 28Macros: 29 30 EXIT_FAILURE 31 EXIT_SUCCESS 32 MB_CUR_MAX 33 NULL 34 RAND_MAX 35 36Types: 37 38 size_t 39 div_t 40 ldiv_t 41 lldiv_t // C99 42 43double atof (const char* nptr); 44int atoi (const char* nptr); 45long atol (const char* nptr); 46long long atoll(const char* nptr); // C99 47double strtod (const char* restrict nptr, char** restrict endptr); 48float strtof (const char* restrict nptr, char** restrict endptr); // C99 49long double strtold (const char* restrict nptr, char** restrict endptr); // C99 50long strtol (const char* restrict nptr, char** restrict endptr, int base); 51long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99 52unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base); 53unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99 54int rand(void); 55void srand(unsigned int seed); 56void* calloc(size_t nmemb, size_t size); 57void free(void* ptr); 58void* malloc(size_t size); 59void* realloc(void* ptr, size_t size); 60void abort(void); 61int atexit(void (*func)(void)); 62void exit(int status); 63void _Exit(int status); 64char* getenv(const char* name); 65int system(const char* string); 66void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, 67 int (*compar)(const void *, const void *)); 68void qsort(void* base, size_t nmemb, size_t size, 69 int (*compar)(const void *, const void *)); 70int abs( int j); 71long abs( long j); 72long long abs(long long j); // C++0X 73long labs( long j); 74long long llabs(long long j); // C99 75div_t div( int numer, int denom); 76ldiv_t div( long numer, long denom); 77lldiv_t div(long long numer, long long denom); // C++0X 78ldiv_t ldiv( long numer, long denom); 79lldiv_t lldiv(long long numer, long long denom); // C99 80int mblen(const char* s, size_t n); 81int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); 82int wctomb(char* s, wchar_t wchar); 83size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); 84size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); 85int at_quick_exit(void (*func)(void)) // C++11 86void quick_exit(int status); // C++11 87void *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