xref: /freebsd-12.1/contrib/libc++/include/cstdlib (revision 4ba319b5)
17a984708SDavid Chisnall// -*- C++ -*-
27a984708SDavid Chisnall//===--------------------------- cstdlib ----------------------------------===//
37a984708SDavid Chisnall//
47a984708SDavid Chisnall//                     The LLVM Compiler Infrastructure
57a984708SDavid Chisnall//
67a984708SDavid Chisnall// This file is dual licensed under the MIT and the University of Illinois Open
77a984708SDavid Chisnall// Source Licenses. See LICENSE.TXT for details.
87a984708SDavid Chisnall//
97a984708SDavid Chisnall//===----------------------------------------------------------------------===//
107a984708SDavid Chisnall
117a984708SDavid Chisnall#ifndef _LIBCPP_CSTDLIB
127a984708SDavid Chisnall#define _LIBCPP_CSTDLIB
137a984708SDavid Chisnall
147a984708SDavid Chisnall/*
157a984708SDavid Chisnall    cstdlib synopsis
167a984708SDavid Chisnall
177a984708SDavid ChisnallMacros:
187a984708SDavid Chisnall
197a984708SDavid Chisnall    EXIT_FAILURE
207a984708SDavid Chisnall    EXIT_SUCCESS
217a984708SDavid Chisnall    MB_CUR_MAX
227a984708SDavid Chisnall    NULL
237a984708SDavid Chisnall    RAND_MAX
247a984708SDavid Chisnall
257a984708SDavid Chisnallnamespace std
267a984708SDavid Chisnall{
277a984708SDavid Chisnall
287a984708SDavid ChisnallTypes:
297a984708SDavid Chisnall
307a984708SDavid Chisnall    size_t
317a984708SDavid Chisnall    div_t
327a984708SDavid Chisnall    ldiv_t
337a984708SDavid Chisnall    lldiv_t                                                               // C99
347a984708SDavid Chisnall
357a984708SDavid Chisnalldouble    atof (const char* nptr);
367a984708SDavid Chisnallint       atoi (const char* nptr);
377a984708SDavid Chisnalllong      atol (const char* nptr);
387a984708SDavid Chisnalllong long atoll(const char* nptr);                                        // C99
397a984708SDavid Chisnalldouble             strtod  (const char* restrict nptr, char** restrict endptr);
407a984708SDavid Chisnallfloat              strtof  (const char* restrict nptr, char** restrict endptr); // C99
417a984708SDavid Chisnalllong double        strtold (const char* restrict nptr, char** restrict endptr); // C99
427a984708SDavid Chisnalllong               strtol  (const char* restrict nptr, char** restrict endptr, int base);
437a984708SDavid Chisnalllong long          strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
447a984708SDavid Chisnallunsigned long      strtoul (const char* restrict nptr, char** restrict endptr, int base);
457a984708SDavid Chisnallunsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
467a984708SDavid Chisnallint rand(void);
477a984708SDavid Chisnallvoid srand(unsigned int seed);
487a984708SDavid Chisnallvoid* calloc(size_t nmemb, size_t size);
497a984708SDavid Chisnallvoid free(void* ptr);
507a984708SDavid Chisnallvoid* malloc(size_t size);
517a984708SDavid Chisnallvoid* realloc(void* ptr, size_t size);
527a984708SDavid Chisnallvoid abort(void);
537a984708SDavid Chisnallint atexit(void (*func)(void));
547a984708SDavid Chisnallvoid exit(int status);
557a984708SDavid Chisnallvoid _Exit(int status);
567a984708SDavid Chisnallchar* getenv(const char* name);
577a984708SDavid Chisnallint system(const char* string);
587a984708SDavid Chisnallvoid* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
597a984708SDavid Chisnall              int (*compar)(const void *, const void *));
607a984708SDavid Chisnallvoid qsort(void* base, size_t nmemb, size_t size,
617a984708SDavid Chisnall           int (*compar)(const void *, const void *));
627a984708SDavid Chisnallint         abs(      int j);
637a984708SDavid Chisnalllong        abs(     long j);
647a984708SDavid Chisnalllong long   abs(long long j);                                             // C++0X
657a984708SDavid Chisnalllong       labs(     long j);
667a984708SDavid Chisnalllong long llabs(long long j);                                             // C99
677a984708SDavid Chisnalldiv_t     div(      int numer,       int denom);
687a984708SDavid Chisnallldiv_t    div(     long numer,      long denom);
697a984708SDavid Chisnalllldiv_t   div(long long numer, long long denom);                          // C++0X
707a984708SDavid Chisnallldiv_t   ldiv(     long numer,      long denom);
717a984708SDavid Chisnalllldiv_t lldiv(long long numer, long long denom);                          // C99
727a984708SDavid Chisnallint mblen(const char* s, size_t n);
737a984708SDavid Chisnallint mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
747a984708SDavid Chisnallint wctomb(char* s, wchar_t wchar);
757a984708SDavid Chisnallsize_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
767a984708SDavid Chisnallsize_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
77936e9439SDimitry Andricint at_quick_exit(void (*func)(void))                                     // C++11
78936e9439SDimitry Andricvoid quick_exit(int status);                                              // C++11
79936e9439SDimitry Andricvoid *aligned_alloc(size_t alignment, size_t size);                       // C11
807a984708SDavid Chisnall
817a984708SDavid Chisnall}  // std
827a984708SDavid Chisnall
837a984708SDavid Chisnall*/
847a984708SDavid Chisnall
857a984708SDavid Chisnall#include <__config>
867a984708SDavid Chisnall#include <stdlib.h>
877a984708SDavid Chisnall
887a984708SDavid Chisnall#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
897a984708SDavid Chisnall#pragma GCC system_header
907a984708SDavid Chisnall#endif
917a984708SDavid Chisnall
92aed8d94eSDimitry Andric#ifdef __GNUC__
93aed8d94eSDimitry Andric#define _LIBCPP_UNREACHABLE() __builtin_unreachable()
94aed8d94eSDimitry Andric#else
95aed8d94eSDimitry Andric#define _LIBCPP_UNREACHABLE() _VSTD::abort()
96aed8d94eSDimitry Andric#endif
97aed8d94eSDimitry Andric
987a984708SDavid Chisnall_LIBCPP_BEGIN_NAMESPACE_STD
997a984708SDavid Chisnall
1007a984708SDavid Chisnallusing ::size_t;
1017a984708SDavid Chisnallusing ::div_t;
1027a984708SDavid Chisnallusing ::ldiv_t;
1035f5f8832SDimitry Andric#ifndef _LIBCPP_HAS_NO_LONG_LONG
1047a984708SDavid Chisnallusing ::lldiv_t;
1055f5f8832SDimitry Andric#endif // _LIBCPP_HAS_NO_LONG_LONG
1067a984708SDavid Chisnallusing ::atof;
1077a984708SDavid Chisnallusing ::atoi;
1087a984708SDavid Chisnallusing ::atol;
1095f5f8832SDimitry Andric#ifndef _LIBCPP_HAS_NO_LONG_LONG
1107a984708SDavid Chisnallusing ::atoll;
1115f5f8832SDimitry Andric#endif // _LIBCPP_HAS_NO_LONG_LONG
1127a984708SDavid Chisnallusing ::strtod;
1137a984708SDavid Chisnallusing ::strtof;
1147a984708SDavid Chisnallusing ::strtold;
1157a984708SDavid Chisnallusing ::strtol;
1165f5f8832SDimitry Andric#ifndef _LIBCPP_HAS_NO_LONG_LONG
1177a984708SDavid Chisnallusing ::strtoll;
1185f5f8832SDimitry Andric#endif // _LIBCPP_HAS_NO_LONG_LONG
1197a984708SDavid Chisnallusing ::strtoul;
1205f5f8832SDimitry Andric#ifndef _LIBCPP_HAS_NO_LONG_LONG
1217a984708SDavid Chisnallusing ::strtoull;
1225f5f8832SDimitry Andric#endif // _LIBCPP_HAS_NO_LONG_LONG
1237a984708SDavid Chisnallusing ::rand;
1247a984708SDavid Chisnallusing ::srand;
1257a984708SDavid Chisnallusing ::calloc;
1267a984708SDavid Chisnallusing ::free;
1277a984708SDavid Chisnallusing ::malloc;
1287a984708SDavid Chisnallusing ::realloc;
1297a984708SDavid Chisnallusing ::abort;
1307a984708SDavid Chisnallusing ::atexit;
1317a984708SDavid Chisnallusing ::exit;
1327a984708SDavid Chisnallusing ::_Exit;
133540d2a8bSDimitry Andric#ifndef _LIBCPP_WINDOWS_STORE_APP
1347a984708SDavid Chisnallusing ::getenv;
1357a984708SDavid Chisnallusing ::system;
136540d2a8bSDimitry Andric#endif
1377a984708SDavid Chisnallusing ::bsearch;
1387a984708SDavid Chisnallusing ::qsort;
1397a984708SDavid Chisnallusing ::abs;
1407a984708SDavid Chisnallusing ::labs;
1415f5f8832SDimitry Andric#ifndef _LIBCPP_HAS_NO_LONG_LONG
1427a984708SDavid Chisnallusing ::llabs;
1435f5f8832SDimitry Andric#endif // _LIBCPP_HAS_NO_LONG_LONG
1447a984708SDavid Chisnallusing ::div;
1457a984708SDavid Chisnallusing ::ldiv;
1465f5f8832SDimitry Andric#ifndef _LIBCPP_HAS_NO_LONG_LONG
1477a984708SDavid Chisnallusing ::lldiv;
1485f5f8832SDimitry Andric#endif // _LIBCPP_HAS_NO_LONG_LONG
1497a984708SDavid Chisnallusing ::mblen;
1507a984708SDavid Chisnallusing ::mbtowc;
1517a984708SDavid Chisnallusing ::wctomb;
1527a984708SDavid Chisnallusing ::mbstowcs;
1537a984708SDavid Chisnallusing ::wcstombs;
154*4ba319b5SDimitry Andric#if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT)
1555cd69373SDavid Chisnallusing ::at_quick_exit;
1565cd69373SDavid Chisnallusing ::quick_exit;
1575cd69373SDavid Chisnall#endif
158*4ba319b5SDimitry Andric#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
159936e9439SDimitry Andricusing ::aligned_alloc;
160936e9439SDimitry Andric#endif
1617a984708SDavid Chisnall
1627a984708SDavid Chisnall_LIBCPP_END_NAMESPACE_STD
1637a984708SDavid Chisnall
1647a984708SDavid Chisnall#endif  // _LIBCPP_CSTDLIB
165