[libcxx] r187593 - Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which is

Howard Hinnant hhinnant at apple.com
Thu Aug 1 11:17:35 PDT 2013


Author: hhinnant
Date: Thu Aug  1 13:17:34 2013
New Revision: 187593

URL: http://llvm.org/viewvc/llvm-project?rev=187593&view=rev
Log:
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.

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/__locale
    libcxx/trunk/include/algorithm
    libcxx/trunk/include/cctype
    libcxx/trunk/include/cmath
    libcxx/trunk/include/cstdio
    libcxx/trunk/include/cstdlib
    libcxx/trunk/include/cstring
    libcxx/trunk/include/cwchar
    libcxx/trunk/include/limits
    libcxx/trunk/include/locale
    libcxx/trunk/include/string
    libcxx/trunk/include/support/win32/limits_win32.h
    libcxx/trunk/include/support/win32/math_win32.h
    libcxx/trunk/include/support/win32/support.h
    libcxx/trunk/include/type_traits
    libcxx/trunk/include/vector
    libcxx/trunk/src/locale.cpp
    libcxx/trunk/src/string.cpp
    libcxx/trunk/test/support/platform_support.h

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu Aug  1 13:17:34 2013
@@ -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 __attr
 namespace std {
 }
 
-#endif // __clang__ || __GNUC___ || _MSC_VER
+#endif // __clang__ || __GNUC__ || _LIBCPP_MSVC
 
 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
 typedef unsigned short char16_t;

Modified: libcxx/trunk/include/__locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Thu Aug  1 13:17:34 2013
@@ -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>

Modified: libcxx/trunk/include/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Thu Aug  1 13:17:34 2013
@@ -3988,10 +3988,10 @@ sort(__wrap_iter<_Tp*> __first, __wrap_i
     _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
 _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
 

Modified: libcxx/trunk/include/cctype
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cctype?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/cctype (original)
+++ libcxx/trunk/include/cctype Thu Aug  1 13:17:34 2013
@@ -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

Modified: libcxx/trunk/include/cmath
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cmath?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/cmath (original)
+++ libcxx/trunk/include/cmath Thu Aug  1 13:17:34 2013
@@ -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 f
 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((do
 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((do
 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((do
 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((do
 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((doub
 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((doub
 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((do
 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 {retu
 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((doub
 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((
 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((doub
 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((doub
 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((do
 
 // acosh
 
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
 using ::acosh;
 using ::acoshf;
 
@@ -1060,7 +1060,7 @@ acosh(_A1 __x) _NOEXCEPT {return acosh((
 
 // asinh
 
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
 using ::asinh;
 using ::asinhf;
 
@@ -1075,7 +1075,7 @@ asinh(_A1 __x) _NOEXCEPT {return asinh((
 
 // atanh
 
-#ifndef _MSC_VER
+#ifndef _LIBCPP_MSVCRT
 using ::atanh;
 using ::atanhf;
 
@@ -1090,7 +1090,7 @@ atanh(_A1 __x) _NOEXCEPT {return atanh((
 
 // 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;

Modified: libcxx/trunk/include/cstdio
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstdio?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/cstdio (original)
+++ libcxx/trunk/include/cstdio Thu Aug  1 13:17:34 2013
@@ -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;

Modified: libcxx/trunk/include/cstdlib
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstdlib?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/cstdlib (original)
+++ libcxx/trunk/include/cstdlib Thu Aug  1 13:17:34 2013
@@ -84,9 +84,9 @@ void *aligned_alloc(size_t alignment, si
 
 #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
 #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
 

Modified: libcxx/trunk/include/cstring
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstring?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/cstring (original)
+++ libcxx/trunk/include/cstring Thu Aug  1 13:17:34 2013
@@ -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);}

Modified: libcxx/trunk/include/cwchar
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cwchar?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/cwchar (original)
+++ libcxx/trunk/include/cwchar Thu Aug  1 13:17:34 2013
@@ -106,9 +106,9 @@ size_t wcsrtombs(char* restrict dst, con
 #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;

Modified: libcxx/trunk/include/limits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/limits?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/limits (original)
+++ libcxx/trunk/include/limits Thu Aug  1 13:17:34 2013
@@ -111,9 +111,9 @@ template<> class numeric_limits<cv long
 
 #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
 

Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Thu Aug  1 13:17:34 2013
@@ -186,11 +186,11 @@ template <class charT> class messages_by
 #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>

Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Thu Aug  1 13:17:34 2013
@@ -1032,14 +1032,14 @@ __basic_string_common<__b>::__throw_out_
 #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
 

Modified: libcxx/trunk/include/support/win32/limits_win32.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/limits_win32.h?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/support/win32/limits_win32.h (original)
+++ libcxx/trunk/include/support/win32/limits_win32.h Thu Aug  1 13:17:34 2013
@@ -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

Modified: libcxx/trunk/include/support/win32/math_win32.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/math_win32.h?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/support/win32/math_win32.h (original)
+++ libcxx/trunk/include/support/win32/math_win32.h Thu Aug  1 13:17:34 2013
@@ -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( do
     return _fpclass(num);
 }
 
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVCRT
 
 #endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H

Modified: libcxx/trunk/include/support/win32/support.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/support.h?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/support/win32/support.h (original)
+++ libcxx/trunk/include/support/win32/support.h Thu Aug  1 13:17:34 2013
@@ -30,7 +30,7 @@ size_t wcsnrtombs( char *__restrict dst,
                    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_clzl
     return static_cast<int>(r);
 }
 #endif // !__clang__
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVCRT
 
 #endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Thu Aug  1 13:17:34 2013
@@ -730,7 +730,7 @@ template <class _Tp> struct _LIBCPP_TYPE
 
 // 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(0
 _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
 

Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Thu Aug  1 13:17:34 2013
@@ -309,14 +309,14 @@ __vector_base_common<__b>::__throw_out_o
 #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

Modified: libcxx/trunk/src/locale.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Thu Aug  1 13:17:34 2013
@@ -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(cons
         __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(cons
     // 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(c
         __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(c
         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(c
     // 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*) {}

Modified: libcxx/trunk/src/string.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/src/string.cpp (original)
+++ libcxx/trunk/src/string.cpp Thu Aug  1 13:17:34 2013
@@ -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);

Modified: libcxx/trunk/test/support/platform_support.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/platform_support.h?rev=187593&r1=187592&r2=187593&view=diff
==============================================================================
--- libcxx/trunk/test/support/platform_support.h (original)
+++ libcxx/trunk/test/support/platform_support.h Thu Aug  1 13:17:34 2013
@@ -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();





More information about the cfe-commits mailing list