|
|
|||
File indexing completed on 2026-05-03 08:13:46
0001 // -*- C++ -*- 0002 //===----------------------------------------------------------------------===// 0003 // 0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0005 // See https://llvm.org/LICENSE.txt for license information. 0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0007 // 0008 //===----------------------------------------------------------------------===// 0009 0010 #if defined(__need_malloc_and_calloc) 0011 0012 # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 0013 # pragma GCC system_header 0014 # endif 0015 0016 # include_next <stdlib.h> 0017 0018 #elif !defined(_LIBCPP___CXX03_STDLIB_H) 0019 # define _LIBCPP___CXX03_STDLIB_H 0020 0021 /* 0022 stdlib.h synopsis 0023 0024 Macros: 0025 0026 EXIT_FAILURE 0027 EXIT_SUCCESS 0028 MB_CUR_MAX 0029 NULL 0030 RAND_MAX 0031 0032 Types: 0033 0034 size_t 0035 div_t 0036 ldiv_t 0037 lldiv_t // C99 0038 0039 double atof (const char* nptr); 0040 int atoi (const char* nptr); 0041 long atol (const char* nptr); 0042 long long atoll(const char* nptr); // C99 0043 double strtod (const char* restrict nptr, char** restrict endptr); 0044 float strtof (const char* restrict nptr, char** restrict endptr); // C99 0045 long double strtold (const char* restrict nptr, char** restrict endptr); // C99 0046 long strtol (const char* restrict nptr, char** restrict endptr, int base); 0047 long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99 0048 unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base); 0049 unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99 0050 int rand(void); 0051 void srand(unsigned int seed); 0052 void* calloc(size_t nmemb, size_t size); 0053 void free(void* ptr); 0054 void* malloc(size_t size); 0055 void* realloc(void* ptr, size_t size); 0056 void abort(void); 0057 int atexit(void (*func)(void)); 0058 void exit(int status); 0059 void _Exit(int status); 0060 char* getenv(const char* name); 0061 int system(const char* string); 0062 void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, 0063 int (*compar)(const void *, const void *)); 0064 void qsort(void* base, size_t nmemb, size_t size, 0065 int (*compar)(const void *, const void *)); 0066 int abs( int j); 0067 long abs( long j); 0068 long long abs(long long j); // C++0X 0069 long labs( long j); 0070 long long llabs(long long j); // C99 0071 div_t div( int numer, int denom); 0072 ldiv_t div( long numer, long denom); 0073 lldiv_t div(long long numer, long long denom); // C++0X 0074 ldiv_t ldiv( long numer, long denom); 0075 lldiv_t lldiv(long long numer, long long denom); // C99 0076 int mblen(const char* s, size_t n); 0077 int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); 0078 int wctomb(char* s, wchar_t wchar); 0079 size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); 0080 size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); 0081 int at_quick_exit(void (*func)(void)) // C++11 0082 void quick_exit(int status); // C++11 0083 void *aligned_alloc(size_t alignment, size_t size); // C11 0084 0085 */ 0086 0087 # include <__cxx03/__config> 0088 0089 # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 0090 # pragma GCC system_header 0091 # endif 0092 0093 # if __has_include_next(<stdlib.h>) 0094 # include_next <stdlib.h> 0095 # endif 0096 0097 # ifdef __cplusplus 0098 extern "C++" { 0099 // abs 0100 0101 # ifdef abs 0102 # undef abs 0103 # endif 0104 # ifdef labs 0105 # undef labs 0106 # endif 0107 # ifdef llabs 0108 # undef llabs 0109 # endif 0110 0111 // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined 0112 # if !defined(_LIBCPP_MSVCRT) 0113 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); } 0114 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long long abs(long long __x) _NOEXCEPT { return __builtin_llabs(__x); } 0115 # endif // !defined(_LIBCPP_MSVCRT) 0116 0117 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float abs(float __lcpp_x) _NOEXCEPT { 0118 return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h 0119 } 0120 0121 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double abs(double __lcpp_x) _NOEXCEPT { 0122 return __builtin_fabs(__lcpp_x); 0123 } 0124 0125 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double abs(long double __lcpp_x) _NOEXCEPT { 0126 return __builtin_fabsl(__lcpp_x); 0127 } 0128 0129 // div 0130 0131 # ifdef div 0132 # undef div 0133 # endif 0134 # ifdef ldiv 0135 # undef ldiv 0136 # endif 0137 # ifdef lldiv 0138 # undef lldiv 0139 # endif 0140 0141 // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined 0142 # if !defined(_LIBCPP_MSVCRT) 0143 inline _LIBCPP_HIDE_FROM_ABI ldiv_t div(long __x, long __y) _NOEXCEPT { return ::ldiv(__x, __y); } 0144 # if !(defined(__FreeBSD__) && !defined(__LONG_LONG_SUPPORTED)) 0145 inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x, long long __y) _NOEXCEPT { return ::lldiv(__x, __y); } 0146 # endif 0147 # endif // _LIBCPP_MSVCRT 0148 } // extern "C++" 0149 # endif // __cplusplus 0150 0151 #endif // _LIBCPP___CXX03_STDLIB_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|