1*700637cbSDimitry Andric// -*- C++ -*- 2*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 3*700637cbSDimitry Andric// 4*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 6*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7*700637cbSDimitry Andric// 8*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 9*700637cbSDimitry Andric 10*700637cbSDimitry Andric#ifndef _LIBCPP___CXX03_CSTDLIB 11*700637cbSDimitry Andric#define _LIBCPP___CXX03_CSTDLIB 12*700637cbSDimitry Andric 13*700637cbSDimitry Andric/* 14*700637cbSDimitry Andric cstdlib synopsis 15*700637cbSDimitry Andric 16*700637cbSDimitry AndricMacros: 17*700637cbSDimitry Andric 18*700637cbSDimitry Andric EXIT_FAILURE 19*700637cbSDimitry Andric EXIT_SUCCESS 20*700637cbSDimitry Andric MB_CUR_MAX 21*700637cbSDimitry Andric NULL 22*700637cbSDimitry Andric RAND_MAX 23*700637cbSDimitry Andric 24*700637cbSDimitry Andricnamespace std 25*700637cbSDimitry Andric{ 26*700637cbSDimitry Andric 27*700637cbSDimitry AndricTypes: 28*700637cbSDimitry Andric 29*700637cbSDimitry Andric size_t 30*700637cbSDimitry Andric div_t 31*700637cbSDimitry Andric ldiv_t 32*700637cbSDimitry Andric lldiv_t // C99 33*700637cbSDimitry Andric 34*700637cbSDimitry Andricdouble atof (const char* nptr); 35*700637cbSDimitry Andricint atoi (const char* nptr); 36*700637cbSDimitry Andriclong atol (const char* nptr); 37*700637cbSDimitry Andriclong long atoll(const char* nptr); // C99 38*700637cbSDimitry Andricdouble strtod (const char* restrict nptr, char** restrict endptr); 39*700637cbSDimitry Andricfloat strtof (const char* restrict nptr, char** restrict endptr); // C99 40*700637cbSDimitry Andriclong double strtold (const char* restrict nptr, char** restrict endptr); // C99 41*700637cbSDimitry Andriclong strtol (const char* restrict nptr, char** restrict endptr, int base); 42*700637cbSDimitry Andriclong long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99 43*700637cbSDimitry Andricunsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base); 44*700637cbSDimitry Andricunsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99 45*700637cbSDimitry Andricint rand(void); 46*700637cbSDimitry Andricvoid srand(unsigned int seed); 47*700637cbSDimitry Andricvoid* calloc(size_t nmemb, size_t size); 48*700637cbSDimitry Andricvoid free(void* ptr); 49*700637cbSDimitry Andricvoid* malloc(size_t size); 50*700637cbSDimitry Andricvoid* realloc(void* ptr, size_t size); 51*700637cbSDimitry Andricvoid abort(void); 52*700637cbSDimitry Andricint atexit(void (*func)(void)); 53*700637cbSDimitry Andricvoid exit(int status); 54*700637cbSDimitry Andricvoid _Exit(int status); 55*700637cbSDimitry Andricchar* getenv(const char* name); 56*700637cbSDimitry Andricint system(const char* string); 57*700637cbSDimitry Andricvoid* bsearch(const void* key, const void* base, size_t nmemb, size_t size, 58*700637cbSDimitry Andric int (*compar)(const void *, const void *)); 59*700637cbSDimitry Andricvoid qsort(void* base, size_t nmemb, size_t size, 60*700637cbSDimitry Andric int (*compar)(const void *, const void *)); 61*700637cbSDimitry Andricint abs( int j); 62*700637cbSDimitry Andriclong abs( long j); 63*700637cbSDimitry Andriclong long abs(long long j); // C++0X 64*700637cbSDimitry Andriclong labs( long j); 65*700637cbSDimitry Andriclong long llabs(long long j); // C99 66*700637cbSDimitry Andricdiv_t div( int numer, int denom); 67*700637cbSDimitry Andricldiv_t div( long numer, long denom); 68*700637cbSDimitry Andriclldiv_t div(long long numer, long long denom); // C++0X 69*700637cbSDimitry Andricldiv_t ldiv( long numer, long denom); 70*700637cbSDimitry Andriclldiv_t lldiv(long long numer, long long denom); // C99 71*700637cbSDimitry Andricint mblen(const char* s, size_t n); 72*700637cbSDimitry Andricint mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); 73*700637cbSDimitry Andricint wctomb(char* s, wchar_t wchar); 74*700637cbSDimitry Andricsize_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); 75*700637cbSDimitry Andricsize_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); 76*700637cbSDimitry Andricint at_quick_exit(void (*func)(void)) // C++11 77*700637cbSDimitry Andricvoid quick_exit(int status); // C++11 78*700637cbSDimitry Andricvoid *aligned_alloc(size_t alignment, size_t size); // C11 79*700637cbSDimitry Andric 80*700637cbSDimitry Andric} // std 81*700637cbSDimitry Andric 82*700637cbSDimitry Andric*/ 83*700637cbSDimitry Andric 84*700637cbSDimitry Andric#include <__cxx03/__config> 85*700637cbSDimitry Andric 86*700637cbSDimitry Andric#include <__cxx03/stdlib.h> 87*700637cbSDimitry Andric 88*700637cbSDimitry Andric#ifndef _LIBCPP___CXX03_STDLIB_H 89*700637cbSDimitry Andric# error <cstdlib> tried including <stdlib.h> but didn't find libc++'s <stdlib.h> header. \ 90*700637cbSDimitry Andric This usually means that your header search paths are not configured properly. \ 91*700637cbSDimitry Andric The header search paths should contain the C++ Standard Library headers before \ 92*700637cbSDimitry Andric any C Standard Library, and you are probably using compiler flags that make that \ 93*700637cbSDimitry Andric not be the case. 94*700637cbSDimitry Andric#endif 95*700637cbSDimitry Andric 96*700637cbSDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 97*700637cbSDimitry Andric# pragma GCC system_header 98*700637cbSDimitry Andric#endif 99*700637cbSDimitry Andric 100*700637cbSDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD 101*700637cbSDimitry Andric 102*700637cbSDimitry Andricusing ::size_t _LIBCPP_USING_IF_EXISTS; 103*700637cbSDimitry Andricusing ::div_t _LIBCPP_USING_IF_EXISTS; 104*700637cbSDimitry Andricusing ::ldiv_t _LIBCPP_USING_IF_EXISTS; 105*700637cbSDimitry Andricusing ::lldiv_t _LIBCPP_USING_IF_EXISTS; 106*700637cbSDimitry Andricusing ::atof _LIBCPP_USING_IF_EXISTS; 107*700637cbSDimitry Andricusing ::atoi _LIBCPP_USING_IF_EXISTS; 108*700637cbSDimitry Andricusing ::atol _LIBCPP_USING_IF_EXISTS; 109*700637cbSDimitry Andricusing ::atoll _LIBCPP_USING_IF_EXISTS; 110*700637cbSDimitry Andricusing ::strtod _LIBCPP_USING_IF_EXISTS; 111*700637cbSDimitry Andricusing ::strtof _LIBCPP_USING_IF_EXISTS; 112*700637cbSDimitry Andricusing ::strtold _LIBCPP_USING_IF_EXISTS; 113*700637cbSDimitry Andricusing ::strtol _LIBCPP_USING_IF_EXISTS; 114*700637cbSDimitry Andricusing ::strtoll _LIBCPP_USING_IF_EXISTS; 115*700637cbSDimitry Andricusing ::strtoul _LIBCPP_USING_IF_EXISTS; 116*700637cbSDimitry Andricusing ::strtoull _LIBCPP_USING_IF_EXISTS; 117*700637cbSDimitry Andricusing ::rand _LIBCPP_USING_IF_EXISTS; 118*700637cbSDimitry Andricusing ::srand _LIBCPP_USING_IF_EXISTS; 119*700637cbSDimitry Andricusing ::calloc _LIBCPP_USING_IF_EXISTS; 120*700637cbSDimitry Andricusing ::free _LIBCPP_USING_IF_EXISTS; 121*700637cbSDimitry Andricusing ::malloc _LIBCPP_USING_IF_EXISTS; 122*700637cbSDimitry Andricusing ::realloc _LIBCPP_USING_IF_EXISTS; 123*700637cbSDimitry Andricusing ::abort _LIBCPP_USING_IF_EXISTS; 124*700637cbSDimitry Andricusing ::atexit _LIBCPP_USING_IF_EXISTS; 125*700637cbSDimitry Andricusing ::exit _LIBCPP_USING_IF_EXISTS; 126*700637cbSDimitry Andricusing ::_Exit _LIBCPP_USING_IF_EXISTS; 127*700637cbSDimitry Andricusing ::getenv _LIBCPP_USING_IF_EXISTS; 128*700637cbSDimitry Andricusing ::system _LIBCPP_USING_IF_EXISTS; 129*700637cbSDimitry Andricusing ::bsearch _LIBCPP_USING_IF_EXISTS; 130*700637cbSDimitry Andricusing ::qsort _LIBCPP_USING_IF_EXISTS; 131*700637cbSDimitry Andricusing ::abs _LIBCPP_USING_IF_EXISTS; 132*700637cbSDimitry Andricusing ::labs _LIBCPP_USING_IF_EXISTS; 133*700637cbSDimitry Andricusing ::llabs _LIBCPP_USING_IF_EXISTS; 134*700637cbSDimitry Andricusing ::div _LIBCPP_USING_IF_EXISTS; 135*700637cbSDimitry Andricusing ::ldiv _LIBCPP_USING_IF_EXISTS; 136*700637cbSDimitry Andricusing ::lldiv _LIBCPP_USING_IF_EXISTS; 137*700637cbSDimitry Andricusing ::mblen _LIBCPP_USING_IF_EXISTS; 138*700637cbSDimitry Andric#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS 139*700637cbSDimitry Andricusing ::mbtowc _LIBCPP_USING_IF_EXISTS; 140*700637cbSDimitry Andricusing ::wctomb _LIBCPP_USING_IF_EXISTS; 141*700637cbSDimitry Andricusing ::mbstowcs _LIBCPP_USING_IF_EXISTS; 142*700637cbSDimitry Andricusing ::wcstombs _LIBCPP_USING_IF_EXISTS; 143*700637cbSDimitry Andric#endif 144*700637cbSDimitry Andric 145*700637cbSDimitry Andric_LIBCPP_END_NAMESPACE_STD 146*700637cbSDimitry Andric 147*700637cbSDimitry Andric#endif // _LIBCPP___CXX03_CSTDLIB 148