From 4022bac855a790b3a42fcb44c06f62dbbe078c5a Mon Sep 17 00:00:00 2001 From: Loo Rong Jie Date: Mon, 11 Jun 2018 02:04:52 -0700 Subject: Remove usage of COMPILER_MSVC in Bazel and ijar Convert most `COMPILER_MSVC` to `_WIN32` (as they apply to Windows platform, not MSVC compiler). Only `src/tools/singlejar/zip_headers.h` and `src/main/cpp/util/md5.h` actually need `_MSC_VER`. `COMPILER_MSVC` in `third_party/protobuf` are not removed. They can be fixed by updating dependency to newer version. /cc @meteorcloudy Closes #5350. Change-Id: Ibc131abfaf34a0cb2bd338549983ea9d28eaabfe PiperOrigin-RevId: 200019793 --- third_party/ijar/common.h | 4 ++-- third_party/ijar/platform_utils.cc | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'third_party') diff --git a/third_party/ijar/common.h b/third_party/ijar/common.h index 05ad19fef8..c5b841aa7e 100644 --- a/third_party/ijar/common.h +++ b/third_party/ijar/common.h @@ -22,10 +22,10 @@ #include #include -#ifdef COMPILER_MSVC +#ifdef _WIN32 #define PATH_MAX 4096 typedef int mode_t; -#endif // COMPILER_MSVC +#endif // _WIN32 namespace devtools_ijar { diff --git a/third_party/ijar/platform_utils.cc b/third_party/ijar/platform_utils.cc index c73827d4b5..4e647b1b89 100644 --- a/third_party/ijar/platform_utils.cc +++ b/third_party/ijar/platform_utils.cc @@ -17,13 +17,13 @@ #include #include -#if defined(COMPILER_MSVC) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) #include -#else // !(defined(COMPILER_MSVC) || defined(__CYGWIN__)) +#else // !(defined(_WIN32) || defined(__CYGWIN__)) #include #include #include -#endif // defined(COMPILER_MSVC) || defined(__CYGWIN__) +#endif // defined(_WIN32) || defined(__CYGWIN__) #include @@ -39,7 +39,7 @@ namespace devtools_ijar { using std::string; bool stat_file(const char* path, Stat* result) { -#if defined(COMPILER_MSVC) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) std::wstring wpath; std::string error; if (!blaze_util::AsAbsoluteWindowsPath(path, &wpath, &error)) { @@ -69,7 +69,7 @@ bool stat_file(const char* path, Stat* result) { } ::CloseHandle(handle); return success; -#else // !(defined(COMPILER_MSVC) || defined(__CYGWIN__)) +#else // !(defined(_WIN32) || defined(__CYGWIN__)) struct stat statst; if (stat(path, &statst) < 0) { return false; @@ -78,7 +78,7 @@ bool stat_file(const char* path, Stat* result) { result->file_mode = statst.st_mode; result->is_directory = (statst.st_mode & S_IFDIR) != 0; return true; -#endif // defined(COMPILER_MSVC) || defined(__CYGWIN__) +#endif // defined(_WIN32) || defined(__CYGWIN__) } bool write_file(const char* path, unsigned int perm, const void* data, @@ -93,10 +93,10 @@ bool read_file(const char* path, void* buffer, size_t size) { string get_cwd() { return blaze_util::GetCwd(); } bool make_dirs(const char* path, unsigned int mode) { -#ifndef COMPILER_MSVC +#ifndef _WIN32 // TODO(laszlocsomor): respect `mode` on Windows/MSVC. mode |= S_IWUSR | S_IXUSR; -#endif // not COMPILER_MSVC +#endif // not _WIN32 string spath(path); if (spath.empty()) { return true; -- cgit v1.2.3