clean up use of _WIN32

Replace the use of _WIN32 in libc++. Replace most use with a C runtime
check _LIBCPP_MSVCRT or the new _LIBCPP_WIN32 to indicate that we are
using the Win32 API. Use a new _LIBCPP_WCHAR_IS_UCS2 to indicate that we
are on an environment that has a short wchar_t.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290910 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool
2017-01-03 21:53:51 +00:00
parent e262e7b914
commit e34f9d5ef3
10 changed files with 48 additions and 39 deletions

View File

@@ -12,7 +12,7 @@
#include "system_error" // __throw_system_error
#include <time.h> // clock_gettime, CLOCK_MONOTONIC and CLOCK_REALTIME
#if defined(_WIN32)
#if defined(_LIBCPP_WIN32API)
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRA_LEAN
#include <Windows.h>
@@ -22,13 +22,13 @@
#else
#if !defined(CLOCK_REALTIME)
#include <sys/time.h> // for gettimeofday and timeval
#endif
#endif
#endif // !defined(CLOCK_REALTIME)
#endif // defined(_LIBCPP_WIN32API)
#if !defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK)
#if __APPLE__
#include <mach/mach_time.h> // mach_absolute_time, mach_timebase_info_data_t
#elif !defined(_WIN32) && !defined(CLOCK_MONOTONIC)
#elif !defined(_LIBCPP_WIN32API) && !defined(CLOCK_MONOTONIC)
#error "Monotonic clock not implemented"
#endif
#endif
@@ -45,7 +45,7 @@ const bool system_clock::is_steady;
system_clock::time_point
system_clock::now() _NOEXCEPT
{
#if defined(_WIN32)
#if defined(_LIBCPP_WIN32API)
// FILETIME is in 100ns units
using filetime_duration =
_VSTD::chrono::duration<__int64,
@@ -158,7 +158,7 @@ steady_clock::now() _NOEXCEPT
return time_point(duration(fp()));
}
#elif defined(_WIN32)
#elif defined(_LIBCPP_WIN32API)
steady_clock::time_point
steady_clock::now() _NOEXCEPT