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
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
#error "This header is MSVC specific, Clang and GCC should not include it"
|
||||
#if !defined(_LIBCPP_MSVCRT)
|
||||
#error "This header complements Microsoft's C Runtime library, and should not be included otherwise."
|
||||
#else
|
||||
|
||||
#ifndef NOMINMAX
|
||||
@@ -74,6 +74,6 @@
|
||||
#define __builtin_nansf(__dummy) _FSnan._Float
|
||||
#define __builtin_nansl(__dummy) _LSnan._Long_double
|
||||
|
||||
#endif // _MSC_VER
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
|
||||
|
@@ -11,8 +11,8 @@
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
#error "This header is MSVC specific, Clang and GCC should not include it"
|
||||
#if !defined(_LIBCPP_MSVCRT)
|
||||
#error "This header complements Microsoft's C Runtime library, and should not be included otherwise."
|
||||
#else
|
||||
|
||||
#include <math.h>
|
||||
@@ -108,6 +108,6 @@ _LIBCPP_ALWAYS_INLINE int fpclassify( double num )
|
||||
return _fpclass(num);
|
||||
}
|
||||
|
||||
#endif // _MSC_VER
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
|
||||
|
@@ -30,7 +30,7 @@ size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src,
|
||||
size_t nwc, size_t len, mbstate_t *__restrict ps );
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#define snprintf _snprintf
|
||||
#include <xlocinfo.h>
|
||||
#define atoll _atoi64
|
||||
@@ -109,6 +109,6 @@ _LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
|
||||
return static_cast<int>(r);
|
||||
}
|
||||
#endif // !__clang__
|
||||
#endif // _MSC_VER
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H
|
||||
|
Reference in New Issue
Block a user