1*4d6fc14bSjoerg// -*- C++ -*- 2*4d6fc14bSjoerg//===--------------------------- cstdlib ----------------------------------===// 3*4d6fc14bSjoerg// 4*4d6fc14bSjoerg// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5*4d6fc14bSjoerg// See https://llvm.org/LICENSE.txt for license information. 6*4d6fc14bSjoerg// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7*4d6fc14bSjoerg// 8*4d6fc14bSjoerg//===----------------------------------------------------------------------===// 9*4d6fc14bSjoerg 10*4d6fc14bSjoerg#ifndef _LIBCPP_CSTDLIB 11*4d6fc14bSjoerg#define _LIBCPP_CSTDLIB 12*4d6fc14bSjoerg 13*4d6fc14bSjoerg/* 14*4d6fc14bSjoerg cstdlib synopsis 15*4d6fc14bSjoerg 16*4d6fc14bSjoergMacros: 17*4d6fc14bSjoerg 18*4d6fc14bSjoerg EXIT_FAILURE 19*4d6fc14bSjoerg EXIT_SUCCESS 20*4d6fc14bSjoerg MB_CUR_MAX 21*4d6fc14bSjoerg NULL 22*4d6fc14bSjoerg RAND_MAX 23*4d6fc14bSjoerg 24*4d6fc14bSjoergnamespace std 25*4d6fc14bSjoerg{ 26*4d6fc14bSjoerg 27*4d6fc14bSjoergTypes: 28*4d6fc14bSjoerg 29*4d6fc14bSjoerg size_t 30*4d6fc14bSjoerg div_t 31*4d6fc14bSjoerg ldiv_t 32*4d6fc14bSjoerg lldiv_t // C99 33*4d6fc14bSjoerg 34*4d6fc14bSjoergdouble atof (const char* nptr); 35*4d6fc14bSjoergint atoi (const char* nptr); 36*4d6fc14bSjoerglong atol (const char* nptr); 37*4d6fc14bSjoerglong long atoll(const char* nptr); // C99 38*4d6fc14bSjoergdouble strtod (const char* restrict nptr, char** restrict endptr); 39*4d6fc14bSjoergfloat strtof (const char* restrict nptr, char** restrict endptr); // C99 40*4d6fc14bSjoerglong double strtold (const char* restrict nptr, char** restrict endptr); // C99 41*4d6fc14bSjoerglong strtol (const char* restrict nptr, char** restrict endptr, int base); 42*4d6fc14bSjoerglong long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99 43*4d6fc14bSjoergunsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base); 44*4d6fc14bSjoergunsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99 45*4d6fc14bSjoergint rand(void); 46*4d6fc14bSjoergvoid srand(unsigned int seed); 47*4d6fc14bSjoergvoid* calloc(size_t nmemb, size_t size); 48*4d6fc14bSjoergvoid free(void* ptr); 49*4d6fc14bSjoergvoid* malloc(size_t size); 50*4d6fc14bSjoergvoid* realloc(void* ptr, size_t size); 51*4d6fc14bSjoergvoid abort(void); 52*4d6fc14bSjoergint atexit(void (*func)(void)); 53*4d6fc14bSjoergvoid exit(int status); 54*4d6fc14bSjoergvoid _Exit(int status); 55*4d6fc14bSjoergchar* getenv(const char* name); 56*4d6fc14bSjoergint system(const char* string); 57*4d6fc14bSjoergvoid* bsearch(const void* key, const void* base, size_t nmemb, size_t size, 58*4d6fc14bSjoerg int (*compar)(const void *, const void *)); 59*4d6fc14bSjoergvoid qsort(void* base, size_t nmemb, size_t size, 60*4d6fc14bSjoerg int (*compar)(const void *, const void *)); 61*4d6fc14bSjoergint abs( int j); 62*4d6fc14bSjoerglong abs( long j); 63*4d6fc14bSjoerglong long abs(long long j); // C++0X 64*4d6fc14bSjoerglong labs( long j); 65*4d6fc14bSjoerglong long llabs(long long j); // C99 66*4d6fc14bSjoergdiv_t div( int numer, int denom); 67*4d6fc14bSjoergldiv_t div( long numer, long denom); 68*4d6fc14bSjoerglldiv_t div(long long numer, long long denom); // C++0X 69*4d6fc14bSjoergldiv_t ldiv( long numer, long denom); 70*4d6fc14bSjoerglldiv_t lldiv(long long numer, long long denom); // C99 71*4d6fc14bSjoergint mblen(const char* s, size_t n); 72*4d6fc14bSjoergint mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); 73*4d6fc14bSjoergint wctomb(char* s, wchar_t wchar); 74*4d6fc14bSjoergsize_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); 75*4d6fc14bSjoergsize_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); 76*4d6fc14bSjoergint at_quick_exit(void (*func)(void)) // C++11 77*4d6fc14bSjoergvoid quick_exit(int status); // C++11 78*4d6fc14bSjoergvoid *aligned_alloc(size_t alignment, size_t size); // C11 79*4d6fc14bSjoerg 80*4d6fc14bSjoerg} // std 81*4d6fc14bSjoerg 82*4d6fc14bSjoerg*/ 83*4d6fc14bSjoerg 84*4d6fc14bSjoerg#include <__config> 85*4d6fc14bSjoerg#include <stdlib.h> 86*4d6fc14bSjoerg 87*4d6fc14bSjoerg#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 88*4d6fc14bSjoerg#pragma GCC system_header 89*4d6fc14bSjoerg#endif 90*4d6fc14bSjoerg 91*4d6fc14bSjoerg#ifdef __GNUC__ 92*4d6fc14bSjoerg#define _LIBCPP_UNREACHABLE() __builtin_unreachable() 93*4d6fc14bSjoerg#else 94*4d6fc14bSjoerg#define _LIBCPP_UNREACHABLE() _VSTD::abort() 95*4d6fc14bSjoerg#endif 96*4d6fc14bSjoerg 97*4d6fc14bSjoerg_LIBCPP_BEGIN_NAMESPACE_STD 98*4d6fc14bSjoerg 99*4d6fc14bSjoergusing ::size_t; 100*4d6fc14bSjoergusing ::div_t; 101*4d6fc14bSjoergusing ::ldiv_t; 102*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_LONG_LONG 103*4d6fc14bSjoergusing ::lldiv_t; 104*4d6fc14bSjoerg#endif // _LIBCPP_HAS_NO_LONG_LONG 105*4d6fc14bSjoergusing ::atof; 106*4d6fc14bSjoergusing ::atoi; 107*4d6fc14bSjoergusing ::atol; 108*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_LONG_LONG 109*4d6fc14bSjoergusing ::atoll; 110*4d6fc14bSjoerg#endif // _LIBCPP_HAS_NO_LONG_LONG 111*4d6fc14bSjoergusing ::strtod; 112*4d6fc14bSjoergusing ::strtof; 113*4d6fc14bSjoergusing ::strtold; 114*4d6fc14bSjoergusing ::strtol; 115*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_LONG_LONG 116*4d6fc14bSjoergusing ::strtoll; 117*4d6fc14bSjoerg#endif // _LIBCPP_HAS_NO_LONG_LONG 118*4d6fc14bSjoergusing ::strtoul; 119*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_LONG_LONG 120*4d6fc14bSjoergusing ::strtoull; 121*4d6fc14bSjoerg#endif // _LIBCPP_HAS_NO_LONG_LONG 122*4d6fc14bSjoergusing ::rand; 123*4d6fc14bSjoergusing ::srand; 124*4d6fc14bSjoergusing ::calloc; 125*4d6fc14bSjoergusing ::free; 126*4d6fc14bSjoergusing ::malloc; 127*4d6fc14bSjoergusing ::realloc; 128*4d6fc14bSjoergusing ::abort; 129*4d6fc14bSjoergusing ::atexit; 130*4d6fc14bSjoergusing ::exit; 131*4d6fc14bSjoergusing ::_Exit; 132*4d6fc14bSjoerg#ifndef _LIBCPP_WINDOWS_STORE_APP 133*4d6fc14bSjoergusing ::getenv; 134*4d6fc14bSjoergusing ::system; 135*4d6fc14bSjoerg#endif 136*4d6fc14bSjoergusing ::bsearch; 137*4d6fc14bSjoergusing ::qsort; 138*4d6fc14bSjoergusing ::abs; 139*4d6fc14bSjoergusing ::labs; 140*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_LONG_LONG 141*4d6fc14bSjoergusing ::llabs; 142*4d6fc14bSjoerg#endif // _LIBCPP_HAS_NO_LONG_LONG 143*4d6fc14bSjoergusing ::div; 144*4d6fc14bSjoergusing ::ldiv; 145*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_LONG_LONG 146*4d6fc14bSjoergusing ::lldiv; 147*4d6fc14bSjoerg#endif // _LIBCPP_HAS_NO_LONG_LONG 148*4d6fc14bSjoergusing ::mblen; 149*4d6fc14bSjoergusing ::mbtowc; 150*4d6fc14bSjoergusing ::wctomb; 151*4d6fc14bSjoergusing ::mbstowcs; 152*4d6fc14bSjoergusing ::wcstombs; 153*4d6fc14bSjoerg#if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT) 154*4d6fc14bSjoergusing ::at_quick_exit; 155*4d6fc14bSjoergusing ::quick_exit; 156*4d6fc14bSjoerg#endif 157*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_ALIGNED_ALLOC) 158*4d6fc14bSjoergusing ::aligned_alloc; 159*4d6fc14bSjoerg#endif 160*4d6fc14bSjoerg 161*4d6fc14bSjoerg_LIBCPP_END_NAMESPACE_STD 162*4d6fc14bSjoerg 163*4d6fc14bSjoerg#endif // _LIBCPP_CSTDLIB 164