diff options
author | Loo Rong Jie <loorongjie@gmail.com> | 2018-06-11 02:04:52 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-11 02:06:38 -0700 |
commit | 4022bac855a790b3a42fcb44c06f62dbbe078c5a (patch) | |
tree | c4f4a7b5fb602020c724b23e3ffcca3804e1207f /third_party | |
parent | 2c89206a407d8cae0945abe7eb179ee6bb77d9de (diff) |
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
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/ijar/common.h | 4 | ||||
-rw-r--r-- | third_party/ijar/platform_utils.cc | 16 |
2 files changed, 10 insertions, 10 deletions
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 <stdint.h> #include <string.h> -#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 <limits.h> #include <stdio.h> -#if defined(COMPILER_MSVC) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) #include <windows.h> -#else // !(defined(COMPILER_MSVC) || defined(__CYGWIN__)) +#else // !(defined(_WIN32) || defined(__CYGWIN__)) #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> -#endif // defined(COMPILER_MSVC) || defined(__CYGWIN__) +#endif // defined(_WIN32) || defined(__CYGWIN__) #include <string> @@ -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; |