diff options
Diffstat (limited to 'include/stdlib.h')
-rw-r--r-- | include/stdlib.h | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index f11c5e76226ef..1d6827587037c 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,19 +1,22 @@ // -*- C++ -*- //===--------------------------- stdlib.h ---------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -#if defined(__need_malloc_and_calloc) +#if defined(__need_malloc_and_calloc) || defined(_LIBCPP_STDLIB_INCLUDE_NEXT) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +#if defined(_LIBCPP_STDLIB_INCLUDE_NEXT) +#undef _LIBCPP_STDLIB_INCLUDE_NEXT +#endif + #include_next <stdlib.h> #elif !defined(_LIBCPP_STDLIB_H) @@ -94,33 +97,7 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 #include_next <stdlib.h> #ifdef __cplusplus - -extern "C++" { - -#undef abs -#undef div -#undef labs -#undef ldiv -#ifndef _LIBCPP_HAS_NO_LONG_LONG -#undef llabs -#undef lldiv -#endif - -// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined -#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX) -inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} -#ifndef _LIBCPP_HAS_NO_LONG_LONG -inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} -#endif // _LIBCPP_HAS_NO_LONG_LONG - -inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);} -#ifndef _LIBCPP_HAS_NO_LONG_LONG -inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);} -#endif // _LIBCPP_HAS_NO_LONG_LONG -#endif // _LIBCPP_MSVCRT / __sun__ / _AIX - -} // extern "C++" - +#include <math.h> #endif // __cplusplus #endif // _LIBCPP_STDLIB_H |