diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2013-08-01 18:17:34 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2013-08-01 18:17:34 +0000 |
| commit | e9df0a5c6c864f1ea86486881a3ee559c56105e7 (patch) | |
| tree | c09db58962428398dc711ef9630e61b998401a12 /include/cstdlib | |
| parent | 56dcf0b8090bd82f3c7f94d14ea572384706f831 (diff) | |
| download | external_libcxx-e9df0a5c6c864f1ea86486881a3ee559c56105e7.tar.gz external_libcxx-e9df0a5c6c864f1ea86486881a3ee559c56105e7.tar.bz2 external_libcxx-e9df0a5c6c864f1ea86486881a3ee559c56105e7.zip | |
Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which is
MSVC-specific, MSVCRT-specific, or Windows-specific. Because Clang can
also define _MSC_VER, and MSVCRT is not necessarily the only C runtime,
these macros should not be used interchangeably.
This patch divides all Windows-related bits into the aforementioned
categories. Two new macros are introduced:
- _LIBCPP_MSVC: Defined when compiling with MSVC. Detected using
_MSC_VER, excluding Clang.
- _LIBCPP_MSVCRT: Defined when using the Microsoft CRT. This is the default
when _WIN32 is defined.
This leaves _WIN32 for code using the Windows API.
This also corrects the spelling of _LIBCP_HAS_IS_BASE_OF to _LIBCPP_HAS_IS_BASE_OF.
Nico, please prepare a patch for CREDITS.TXT, thanks.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/cstdlib')
| -rw-r--r-- | include/cstdlib | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/cstdlib b/include/cstdlib index 95e384283..0a96fb0a8 100644 --- a/include/cstdlib +++ b/include/cstdlib @@ -84,9 +84,9 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 #include <__config> #include <stdlib.h> -#ifdef _MSC_VER +#ifdef _LIBCPP_MSVCRT #include "support/win32/locale_win32.h" -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -154,8 +154,8 @@ using ::quick_exit; using ::aligned_alloc; #endif -// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus -#if !defined(_MSC_VER) && !defined(__sun__) +// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus +#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) 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);} @@ -165,7 +165,7 @@ inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEX #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 // _MSC_VER +#endif // _LIBCPP_MSVCRT _LIBCPP_END_NAMESPACE_STD |
