aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Loo Rong Jie <loorongjie@gmail.com>2018-06-11 02:04:52 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-11 02:06:38 -0700
commit4022bac855a790b3a42fcb44c06f62dbbe078c5a (patch)
treec4f4a7b5fb602020c724b23e3ffcca3804e1207f /tools
parent2c89206a407d8cae0945abe7eb179ee6bb77d9de (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 'tools')
-rw-r--r--tools/cpp/runfiles/runfiles.cc14
-rw-r--r--tools/cpp/runfiles/runfiles_test.cc6
2 files changed, 10 insertions, 10 deletions
diff --git a/tools/cpp/runfiles/runfiles.cc b/tools/cpp/runfiles/runfiles.cc
index 79ca943ca7..64e797f896 100644
--- a/tools/cpp/runfiles/runfiles.cc
+++ b/tools/cpp/runfiles/runfiles.cc
@@ -13,23 +13,23 @@
// limitations under the License.
#include "tools/cpp/runfiles/runfiles.h"
-#ifdef COMPILER_MSVC
+#ifdef _WIN32
#include <windows.h>
-#else // not COMPILER_MSVC
+#else // not _WIN32
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#endif // COMPILER_MSVC
+#endif // _WIN32
#include <fstream>
#include <map>
#include <sstream>
#include <vector>
-#ifdef COMPILER_MSVC
+#ifdef _WIN32
#include <memory>
-#endif // COMPILER_MSVC
+#endif // _WIN32
namespace bazel {
namespace tools {
@@ -79,7 +79,7 @@ bool IsReadableFile(const string& path) {
}
bool IsDirectory(const string& path) {
-#ifdef COMPILER_MSVC
+#ifdef _WIN32
DWORD attrs = GetFileAttributesA(path.c_str());
return (attrs != INVALID_FILE_ATTRIBUTES) &&
(attrs & FILE_ATTRIBUTE_DIRECTORY);
@@ -153,7 +153,7 @@ bool IsAbsolute(const string& path) {
}
string GetEnv(const string& key) {
-#ifdef COMPILER_MSVC
+#ifdef _WIN32
DWORD size = ::GetEnvironmentVariableA(key.c_str(), NULL, 0);
if (size == 0) {
return std::move(string()); // unset or empty envvar
diff --git a/tools/cpp/runfiles/runfiles_test.cc b/tools/cpp/runfiles/runfiles_test.cc
index 4d2b1eafca..17c1d42e27 100644
--- a/tools/cpp/runfiles/runfiles_test.cc
+++ b/tools/cpp/runfiles/runfiles_test.cc
@@ -14,9 +14,9 @@
#include "tools/cpp/runfiles/runfiles.h"
-#ifdef COMPILER_MSVC
+#ifdef _WIN32
#include <windows.h>
-#endif // COMPILER_MSVC
+#endif // _WIN32
#include <fstream>
#include <memory>
@@ -95,7 +95,7 @@ void RunfilesTest::AssertEnvvars(const Runfiles& runfiles,
}
string RunfilesTest::GetTemp() {
-#ifdef COMPILER_MSVC
+#ifdef _WIN32
DWORD size = ::GetEnvironmentVariableA("TEST_TMPDIR", NULL, 0);
if (size == 0) {
return std::move(string()); // unset or empty envvar