diff --git a/port/win/io_win.cc b/port/win/io_win.cc index e050d69ddc..c433e5e522 100644 --- a/port/win/io_win.cc +++ b/port/win/io_win.cc @@ -1025,7 +1025,12 @@ Status WinRandomRWFile::Close() { ////////////////////////////////////////////////////////////////////////// /// WinMemoryMappedBufer WinMemoryMappedBuffer::~WinMemoryMappedBuffer() { - BOOL ret = FALSE; + BOOL ret +#if defined(_MSC_VER) + = FALSE; +#else + __attribute__((__unused__)); +#endif if (base_ != nullptr) { ret = ::UnmapViewOfFile(base_); assert(ret); diff --git a/port/win/win_thread.cc b/port/win/win_thread.cc index 9a976e2c6b..34e54f3017 100644 --- a/port/win/win_thread.cc +++ b/port/win/win_thread.cc @@ -138,7 +138,12 @@ void WindowsThread::join() { "WaitForSingleObjectFailed: thread join"); } - BOOL rc; + BOOL rc +#if defined(_MSC_VER) + = FALSE; +#else + __attribute__((__unused__)); +#endif rc = CloseHandle(reinterpret_cast(data_->handle_)); assert(rc != 0); data_->handle_ = 0; diff --git a/util/status.cc b/util/status.cc index 0b1b249353..d75f9271eb 100644 --- a/util/status.cc +++ b/util/status.cc @@ -21,7 +21,12 @@ const char* Status::CopyState(const char* state) { #ifdef OS_WIN const size_t cch = std::strlen(state) + 1; // +1 for the null terminator char* result = new char[cch]; - errno_t ret; + errno_t ret +#if defined(_MSC_VER) + ; +#else + __attribute__((__unused__)); +#endif ret = strncpy_s(result, cch, state, cch - 1); result[cch - 1] = '\0'; assert(ret == 0);