diff options
Diffstat (limited to 'libcxx/include/stdlib.h')
| -rw-r--r-- | libcxx/include/stdlib.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libcxx/include/stdlib.h b/libcxx/include/stdlib.h index e4dce9c54546..4dd3a9c14ab0 100644 --- a/libcxx/include/stdlib.h +++ b/libcxx/include/stdlib.h @@ -90,7 +90,9 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 # pragma GCC system_header #endif -#include_next <stdlib.h> +# if __has_include_next(<stdlib.h>) +# include_next <stdlib.h> +# endif #ifdef __cplusplus extern "C++" { @@ -108,24 +110,24 @@ extern "C++" { // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined #if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); } -inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT { return __builtin_llabs(__x); } #endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) #if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT { return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h } -inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT { return __builtin_fabs(__lcpp_x); } -inline _LIBCPP_INLINE_VISIBILITY long double +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long double abs(long double __lcpp_x) _NOEXCEPT { return __builtin_fabsl(__lcpp_x); } |
