From 79ae60ed9737f6c0ec652eab5492b1359aaea9cf Mon Sep 17 00:00:00 2001 From: Loo Rong Jie Date: Tue, 28 Nov 2017 13:36:16 +0800 Subject: MSVC fixes --- absl/copts.bzl | 2 ++ absl/time/clock.cc | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'absl') diff --git a/absl/copts.bzl b/absl/copts.bzl index cc8db2f4..f687f58f 100644 --- a/absl/copts.bzl +++ b/absl/copts.bzl @@ -103,7 +103,9 @@ MSVC_FLAGS = [ "/wd4244", # conversion from 'type1' to 'type2', possible loss of data "/wd4267", # conversion from 'size_t' to 'type', possible loss of data "/wd4800", # forcing value to bool 'true' or 'false' (performance warning) + "/DNOMINMAX", # Don't define min and max macros (windows.h) "/DWIN32_LEAN_AND_MEAN", # Don't bloat namespace with incompatible winsock versions. + "/D_CRT_SECURE_NO_WARNINGS", # Don't warn about usage of insecure C functions ] MSVC_TEST_FLAGS = [ diff --git a/absl/time/clock.cc b/absl/time/clock.cc index 6398170d..9f2e0781 100644 --- a/absl/time/clock.cc +++ b/absl/time/clock.cc @@ -510,7 +510,7 @@ namespace { // Returns the maximum duration that SleepOnce() can sleep for. constexpr absl::Duration MaxSleep() { #ifdef _WIN32 - // Windows _sleep() takes unsigned long argument in milliseconds. + // Windows Sleep() takes unsigned long argument in milliseconds. return absl::Milliseconds( std::numeric_limits::max()); // NOLINT(runtime/int) #else @@ -522,7 +522,7 @@ constexpr absl::Duration MaxSleep() { // REQUIRES: to_sleep <= MaxSleep(). void SleepOnce(absl::Duration to_sleep) { #ifdef _WIN32 - _sleep(to_sleep / absl::Milliseconds(1)); + Sleep(to_sleep / absl::Milliseconds(1)); #else struct timespec sleep_time = absl::ToTimespec(to_sleep); while (nanosleep(&sleep_time, &sleep_time) != 0 && errno == EINTR) { -- cgit v1.2.3