summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/include/__config23
-rw-r--r--libcxx/include/__locale2
-rw-r--r--libcxx/include/algorithm8
-rw-r--r--libcxx/include/cctype4
-rw-r--r--libcxx/include/cmath77
-rw-r--r--libcxx/include/cstdio4
-rw-r--r--libcxx/include/cstdlib10
-rw-r--r--libcxx/include/cstring4
-rw-r--r--libcxx/include/cwchar12
-rw-r--r--libcxx/include/limits4
-rw-r--r--libcxx/include/locale6
-rw-r--r--libcxx/include/string8
-rw-r--r--libcxx/include/support/win32/limits_win32.h6
-rw-r--r--libcxx/include/support/win32/math_win32.h6
-rw-r--r--libcxx/include/support/win32/support.h4
-rw-r--r--libcxx/include/type_traits6
-rw-r--r--libcxx/include/vector8
-rw-r--r--libcxx/src/locale.cpp44
-rw-r--r--libcxx/src/string.cpp6
-rw-r--r--libcxx/test/support/platform_support.h2
20 files changed, 127 insertions, 117 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index f003e5b0e41..fa6abf626ab 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -11,7 +11,7 @@
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
-#ifndef _MSC_VER // explicit macro necessary because it is only defined below in this file
+#if !defined(_MSC_VER) || defined(__clang__)
#pragma GCC system_header
#endif
@@ -72,15 +72,20 @@
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC)
-# if (defined(_MSC_VER) && _MSC_VER >= 1400) \
+# if defined(__clang__) \
+ || (defined(_MSC_VER) && _MSC_VER >= 1400) \
|| (defined(__GNUC__) && _GNUC_VER > 403)
-# define _LIBCP_HAS_IS_BASE_OF
+# define _LIBCPP_HAS_IS_BASE_OF
# endif
+# if defined(_MSC_VER) && !defined(__clang__)
+# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
+# endif
+# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
#endif // _WIN32
#ifdef __linux__
# if defined(__GNUC__) && _GNUC_VER >= 403
-# define _LIBCP_HAS_IS_BASE_OF
+# define _LIBCPP_HAS_IS_BASE_OF
# endif
#endif
@@ -128,7 +133,7 @@
#endif
#ifndef _LIBCPP_INLINE_VISIBILITY
-# ifdef _MSC_VER
+# ifdef _LIBCPP_MSVC
# define _LIBCPP_INLINE_VISIBILITY __forceinline
# else // MinGW GCC and Clang
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
@@ -140,7 +145,7 @@
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
-# ifdef _MSC_VER
+# ifdef _LIBCPP_MSVC
# define _LIBCPP_ALWAYS_INLINE __forceinline
# endif
#endif
@@ -273,7 +278,7 @@ typedef __char32_t char32_t;
#endif
#if __has_feature(is_base_of)
-# define _LIBCP_HAS_IS_BASE_OF
+# define _LIBCPP_HAS_IS_BASE_OF
#endif
// Objective-C++ features (opt-in)
@@ -396,7 +401,7 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
-#elif defined(_MSC_VER)
+#elif defined(_LIBCPP_MSVC)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
@@ -418,7 +423,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
namespace std {
}
-#endif // __clang__ || __GNUC___ || _MSC_VER
+#endif // __clang__ || __GNUC__ || _LIBCPP_MSVC
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index 92f4e0ca7a7..93147ec00ac 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -19,7 +19,7 @@
#include <cstdint>
#include <cctype>
#include <locale.h>
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
# include <support/win32/locale_win32.h>
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(EMSCRIPTEN)
# include <xlocale.h>
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 1403fd68fe7..2fc1f8ab4bb 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -3988,10 +3988,10 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
}
-#ifdef _MSC_VER
+#ifdef _LIBCPP_MSVC
#pragma warning( push )
#pragma warning( disable: 4231)
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVC
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<char>&, char*>(char*, char*, __less<char>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
@@ -4025,9 +4025,9 @@ _LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<double>&, double
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
_LIBCPP_EXTERN_TEMPLATE(unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&))
-#ifdef _MSC_VER
+#ifdef _LIBCPP_MSVC
#pragma warning( pop )
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVC
// lower_bound
diff --git a/libcxx/include/cctype b/libcxx/include/cctype
index e33244e7daa..b647903c45c 100644
--- a/libcxx/include/cctype
+++ b/libcxx/include/cctype
@@ -37,9 +37,9 @@ int toupper(int c);
#include <__config>
#include <ctype.h>
-#if defined(_MSC_VER)
+#if defined(_LIBCPP_MSVCRT)
#include "support/win32/support.h"
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/cmath b/libcxx/include/cmath
index bd6034413ee..3e545cea586 100644
--- a/libcxx/include/cmath
+++ b/libcxx/include/cmath
@@ -301,7 +301,7 @@ long double truncl(long double x);
#include <math.h>
#include <type_traits>
-#ifdef _MSC_VER
+#ifdef _LIBCPP_MSVCRT
#include "support/win32/math_win32.h"
#endif
@@ -673,7 +673,7 @@ abs(long double __x) _NOEXCEPT {return fabsl(__x);}
using ::acos;
using ::acosf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) _NOEXCEPT {return acosf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}
#endif
@@ -688,7 +688,7 @@ acos(_A1 __x) _NOEXCEPT {return acos((double)__x);}
using ::asin;
using ::asinf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) _NOEXCEPT {return asinf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}
#endif
@@ -703,7 +703,7 @@ asin(_A1 __x) _NOEXCEPT {return asin((double)__x);}
using ::atan;
using ::atanf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) _NOEXCEPT {return atanf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}
#endif
@@ -718,7 +718,7 @@ atan(_A1 __x) _NOEXCEPT {return atan((double)__x);}
using ::atan2;
using ::atan2f;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) _NOEXCEPT {return atan2f(__y, __x);}
inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}
#endif
@@ -744,7 +744,7 @@ atan2(_A1 __y, _A2 __x) _NOEXCEPT
using ::ceil;
using ::ceilf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) _NOEXCEPT {return ceilf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}
#endif
@@ -759,7 +759,7 @@ ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);}
using ::cos;
using ::cosf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) _NOEXCEPT {return cosf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}
#endif
@@ -774,7 +774,7 @@ cos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
using ::cosh;
using ::coshf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) _NOEXCEPT {return coshf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}
#endif
@@ -792,7 +792,7 @@ using ::expf;
#ifndef __sun__
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) _NOEXCEPT {return expf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}
#endif
@@ -808,7 +808,7 @@ exp(_A1 __x) _NOEXCEPT {return exp((double)__x);}
using ::fabs;
using ::fabsf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) _NOEXCEPT {return fabsf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}
#endif
@@ -823,7 +823,7 @@ fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);}
using ::floor;
using ::floorf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) _NOEXCEPT {return floorf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}
#endif
@@ -840,7 +840,7 @@ using ::fmod;
using ::fmodf;
#ifndef __sun__
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) _NOEXCEPT {return fmodf(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}
#endif
@@ -867,7 +867,7 @@ fmod(_A1 __x, _A2 __y) _NOEXCEPT
using ::frexp;
using ::frexpf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) _NOEXCEPT {return frexpf(__x, __e);}
inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}
#endif
@@ -882,7 +882,7 @@ frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);}
using ::ldexp;
using ::ldexpf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) _NOEXCEPT {return ldexpf(__x, __e);}
inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}
#endif
@@ -899,7 +899,7 @@ using ::log;
using ::logf;
#ifndef __sun__
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float log(float __x) _NOEXCEPT {return logf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}
#endif
@@ -915,7 +915,7 @@ log(_A1 __x) _NOEXCEPT {return log((double)__x);}
using ::log10;
using ::log10f;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) _NOEXCEPT {return log10f(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}
#endif
@@ -930,7 +930,7 @@ log10(_A1 __x) _NOEXCEPT {return log10((double)__x);}
using ::modf;
using ::modff;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) _NOEXCEPT {return modff(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}
#endif
@@ -943,7 +943,7 @@ using ::powf;
#ifndef __sun__
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) _NOEXCEPT {return powf(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}
#endif
@@ -970,7 +970,7 @@ pow(_A1 __x, _A2 __y) _NOEXCEPT
using ::sin;
using ::sinf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) _NOEXCEPT {return sinf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}
#endif
@@ -985,7 +985,7 @@ sin(_A1 __x) _NOEXCEPT {return sin((double)__x);}
using ::sinh;
using ::sinhf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) _NOEXCEPT {return sinhf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}
#endif
@@ -1002,7 +1002,7 @@ using ::sqrt;
using ::sqrtf;
-#if !(defined(_MSC_VER) || defined(__sun__))
+#if !(defined(_LIBCPP_MSVCRT) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) _NOEXCEPT {return sqrtf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}
#endif
@@ -1018,7 +1018,7 @@ using ::tan;
using ::tanf;
#ifndef __sun__
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) _NOEXCEPT {return tanf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}
#endif
@@ -1033,7 +1033,7 @@ tan(_A1 __x) _NOEXCEPT {return tan((double)__x);}
using ::tanh;
using ::tanhf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) _NOEXCEPT {return tanhf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}
#endif
@@ -1045,7 +1045,7 @@ tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);}
// acosh
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
using ::acosh;
using ::acoshf;
@@ -1060,7 +1060,7 @@ acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);}
// asinh
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
using ::asinh;
using ::asinhf;
@@ -1075,7 +1075,7 @@ asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);}
// atanh
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
using ::atanh;
using ::atanhf;
@@ -1090,7 +1090,7 @@ atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);}
// cbrt
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
using ::cbrt;
using ::cbrtf;
@@ -1127,7 +1127,7 @@ copysign(_A1 __x, _A2 __y) _NOEXCEPT
return copysign((__result_type)__x, (__result_type)__y);
}
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
// erf
@@ -1426,13 +1426,18 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long>::type
lround(_A1 __x) _NOEXCEPT {return lround((double)__x);}
-// nan
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVCRT
#endif // __sun__
+
+// nan
+
+#ifndef _LIBCPP_MSVCRT
using ::nan;
using ::nanf;
+#endif // _LIBCPP_MSVCRT
+
#ifndef __sun__
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
// nearbyint
@@ -1610,7 +1615,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}
-#endif // !_MSC_VER
+#endif // !_LIBCPP_MSVCRT
using ::acosl;
using ::asinl;
@@ -1633,15 +1638,15 @@ using ::sinl;
using ::sinhl;
using ::sqrtl;
using ::tanl;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
using ::tanhl;
using ::acoshl;
using ::asinhl;
using ::atanhl;
using ::cbrtl;
-#endif // !_MSC_VER
+#endif // !_LIBCPP_MSVCRT
using ::copysignl;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
using ::erfl;
using ::erfcl;
using ::exp2l;
@@ -1672,7 +1677,7 @@ using ::scalblnl;
using ::scalbnl;
using ::tgammal;
using ::truncl;
-#endif // !_MSC_VER
+#endif // !_LIBCPP_MSVCRT
#else
using ::lgamma;
diff --git a/libcxx/include/cstdio b/libcxx/include/cstdio
index 718d2f71551..1cde3eee536 100644
--- a/libcxx/include/cstdio
+++ b/libcxx/include/cstdio
@@ -138,12 +138,12 @@ using ::scanf;
using ::snprintf;
using ::sprintf;
using ::sscanf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
using ::vfprintf;
using ::vfscanf;
using ::vscanf;
using ::vsscanf;
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVCRT
using ::vprintf;
using ::vsnprintf;
using ::vsprintf;
diff --git a/libcxx/include/cstdlib b/libcxx/include/cstdlib
index 95e384283a7..0a96fb0a858 100644
--- a/libcxx/include/cstdlib
+++ b/libcxx/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
diff --git a/libcxx/include/cstring b/libcxx/include/cstring
index 45075b3af29..21c9155cd4d 100644
--- a/libcxx/include/cstring
+++ b/libcxx/include/cstring
@@ -93,8 +93,8 @@ using ::strspn;
using ::strstr;
-// MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
-#if !defined(__GLIBC__) && !defined(_MSC_VER) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
+// MSVCRT, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
+#if !defined(__GLIBC__) && !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
diff --git a/libcxx/include/cwchar b/libcxx/include/cwchar
index 845ccec335e..90eae75e869 100644
--- a/libcxx/include/cwchar
+++ b/libcxx/include/cwchar
@@ -106,9 +106,9 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config>
#include <cwctype>
#include <wchar.h>
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
#include <support/win32/support.h> // pull in *swprintf defines
-#endif // _WIN32
+#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -127,12 +127,12 @@ using ::swprintf;
using ::vfwprintf;
using ::vswprintf;
using ::vwprintf;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
using ::swscanf;
using ::vfwscanf;
using ::vswscanf;
using ::vwscanf;
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVCRT
using ::wprintf;
using ::wscanf;
using ::fgetwc;
@@ -146,10 +146,10 @@ using ::putwc;
using ::putwchar;
using ::ungetwc;
using ::wcstod;
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
using ::wcstof;
using ::wcstold;
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVCRT
using ::wcstol;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoll;
diff --git a/libcxx/include/limits b/libcxx/include/limits
index 9b9d7a6f828..c995ef5985b 100644
--- a/libcxx/include/limits
+++ b/libcxx/include/limits
@@ -111,9 +111,9 @@ template<> class numeric_limits<cv long double>;
#include <__undef_min_max>
-#if defined(_MSC_VER)
+#if defined(_LIBCPP_MSVCRT)
#include "support/win32/limits_win32.h"
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVCRT
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/include/locale b/libcxx/include/locale
index ef7603d036c..00a275f919e 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -186,11 +186,11 @@ template <class charT> class messages_byname;
#endif
#include <cstdlib>
#include <ctime>
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
#include <support/win32/locale_win32.h>
-#else // _WIN32
+#else // _LIBCPP_MSVCRT
#include <nl_types.h>
-#endif // !_WIN32
+#endif // !_LIBCPP_MSVCRT
#ifdef __APPLE__
#include <Availability.h>
diff --git a/libcxx/include/string b/libcxx/include/string
index 88d32b1ca88..283be3a35bc 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1032,14 +1032,14 @@ __basic_string_common<__b>::__throw_out_of_range() const
#endif
}
-#ifdef _MSC_VER
+#ifdef _LIBCPP_MSVC
#pragma warning( push )
#pragma warning( disable: 4231 )
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVC
_LIBCPP_EXTERN_TEMPLATE(class __basic_string_common<true>)
-#ifdef _MSC_VER
+#ifdef _LIBCPP_MSVC
#pragma warning( pop )
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVC
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
diff --git a/libcxx/include/support/win32/limits_win32.h b/libcxx/include/support/win32/limits_win32.h
index 671631df2f9..52229c4ddec 100644
--- a/libcxx/include/support/win32/limits_win32.h
+++ b/libcxx/include/support/win32/limits_win32.h
@@ -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
diff --git a/libcxx/include/support/win32/math_win32.h b/libcxx/include/support/win32/math_win32.h
index 41c50d62474..22400c0d00f 100644
--- a/libcxx/include/support/win32/math_win32.h
+++ b/libcxx/include/support/win32/math_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
diff --git a/libcxx/include/support/win32/support.h b/libcxx/include/support/win32/support.h
index 81cb13a99c5..17abb915f7e 100644
--- a/libcxx/include/support/win32/support.h
+++ b/libcxx/include/support/win32/support.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
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 3d3ae5ea0b0..99e34d13323 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -730,7 +730,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS is_abstract : public __libcpp_abstr
// is_base_of
-#ifdef _LIBCP_HAS_IS_BASE_OF
+#ifdef _LIBCPP_HAS_IS_BASE_OF
template <class _Bp, class _Dp>
struct _LIBCPP_TYPE_VIS is_base_of
@@ -1078,9 +1078,9 @@ _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);
// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000)
-#if !defined(_MSC_VER)
+#if !defined(_LIBCPP_MSVC)
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
-#endif // !_MSC_VER
+#endif // !_LIBCPP_MSVC
#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 046d92dc91b..373e7c13d88 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -309,14 +309,14 @@ __vector_base_common<__b>::__throw_out_of_range() const
#endif
}
-#ifdef _MSC_VER
+#ifdef _LIBCPP_MSVC
#pragma warning( push )
#pragma warning( disable: 4231 )
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVC
_LIBCPP_EXTERN_TEMPLATE(class __vector_base_common<true>)
-#ifdef _MSC_VER
+#ifdef _LIBCPP_MSVC
#pragma warning( pop )
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVC
template <class _Tp, class _Allocator>
class __vector_base
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 6300ce1c54b..d95d0c9c954 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -26,11 +26,11 @@
#include "cstring"
#include "cwctype"
#include "__sso_allocator"
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
#include <support/win32/locale_win32.h>
-#else // _WIN32
+#else // _LIBCPP_MSVCRT
#include <langinfo.h>
-#endif // _!WIN32
+#endif // !_LIBCPP_MSVCRT
#include <stdlib.h>
#include <stdio.h>
@@ -1009,7 +1009,7 @@ ctype<char>::classic_table() _NOEXCEPT
return __cloc()->__ctype_b;
#elif __sun__
return __ctype_mask;
-#elif defined(_WIN32)
+#elif defined(_LIBCPP_MSVCRT)
return _ctype+1; // internal ctype mask table defined in msvcrt.dll
// This is assumed to be safe, which is a nonsense assumption because we're
// going to end up dereferencing it later...
@@ -5848,19 +5848,19 @@ moneypunct_byname<char, true>::init(const char* nm)
__frac_digits_ = lc->int_frac_digits;
else
__frac_digits_ = base::do_frac_digits();
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
if (lc->p_sign_posn == 0)
-#else // _WIN32
+#else // _LIBCPP_MSVCRT
if (lc->int_p_sign_posn == 0)
-#endif //_WIN32
+#endif // !_LIBCPP_MSVCRT
__positive_sign_ = "()";
else
__positive_sign_ = lc->positive_sign;
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
if(lc->n_sign_posn == 0)
-#else // _WIN32
+#else // _LIBCPP_MSVCRT
if (lc->int_n_sign_posn == 0)
-#endif // _WIN32
+#endif // !_LIBCPP_MSVCRT
__negative_sign_ = "()";
else
__negative_sign_ = lc->negative_sign;
@@ -5868,19 +5868,19 @@ moneypunct_byname<char, true>::init(const char* nm)
// the same places in curr_symbol since there's no way to
// represent anything else.
string_type __dummy_curr_symbol = __curr_symbol_;
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
__init_pat(__neg_format_, __curr_symbol_, true,
lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
-#else
+#else // _LIBCPP_MSVCRT
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->int_p_cs_precedes, lc->int_p_sep_by_space,
lc->int_p_sign_posn, ' ');
__init_pat(__neg_format_, __curr_symbol_, true,
lc->int_n_cs_precedes, lc->int_n_sep_by_space,
lc->int_n_sign_posn, ' ');
-#endif // _WIN32
+#endif // !_LIBCPP_MSVCRT
}
template<>
@@ -6007,11 +6007,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
__frac_digits_ = lc->int_frac_digits;
else
__frac_digits_ = base::do_frac_digits();
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
if (lc->p_sign_posn == 0)
-#else // _WIN32
+#else // _LIBCPP_MSVCRT
if (lc->int_p_sign_posn == 0)
-#endif // _WIN32
+#endif // !_LIBCPP_MSVCRT
__positive_sign_ = L"()";
else
{
@@ -6027,11 +6027,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
wbe = wbuf + j;
__positive_sign_.assign(wbuf, wbe);
}
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
if (lc->n_sign_posn == 0)
-#else // _WIN32
+#else // _LIBCPP_MSVCRT
if (lc->int_n_sign_posn == 0)
-#endif // _WIN32
+#endif // !_LIBCPP_MSVCRT
__negative_sign_ = L"()";
else
{
@@ -6051,19 +6051,19 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
// the same places in curr_symbol since there's no way to
// represent anything else.
string_type __dummy_curr_symbol = __curr_symbol_;
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
__init_pat(__neg_format_, __curr_symbol_, true,
lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
-#else // _WIN32
+#else // _LIBCPP_MSVCRT
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->int_p_cs_precedes, lc->int_p_sep_by_space,
lc->int_p_sign_posn, L' ');
__init_pat(__neg_format_, __curr_symbol_, true,
lc->int_n_cs_precedes, lc->int_n_sep_by_space,
lc->int_n_sign_posn, L' ');
-#endif // _WIN32
+#endif // !_LIBCPP_MSVCRT
}
void __do_nothing(void*) {}
diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp
index daed7d25973..5a86911654d 100644
--- a/libcxx/src/string.cpp
+++ b/libcxx/src/string.cpp
@@ -13,9 +13,9 @@
#include "cerrno"
#include "limits"
#include "stdexcept"
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
#include "support/win32/support.h"
-#endif // _WIN32
+#endif // _LIBCPP_MSVCRT
#include <stdio.h>
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -427,7 +427,7 @@ inline
wide_printf
get_swprintf()
{
-#ifndef _WIN32
+#ifndef _LIBCPP_MSVCRT
return swprintf;
#else
return static_cast<int (__cdecl*)(wchar_t* __restrict, size_t, const wchar_t*__restrict, ...)>(swprintf);
diff --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h
index 3ef9e329de1..7900bbf84a5 100644
--- a/libcxx/test/support/platform_support.h
+++ b/libcxx/test/support/platform_support.h
@@ -47,7 +47,7 @@ inline
std::string
get_temp_file_name()
{
-#ifdef _WIN32
+#ifdef _LIBCPP_MSVCRT
char* p = _tempnam( NULL, NULL );
if (p == nullptr)
abort();
OpenPOWER on IntegriCloud