From faac236d26b206cd6a8f4aa6e2bca8a83f0f83fa Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Sun, 22 Jan 2012 10:22:45 -0800 Subject: windows: use _WIN32 define everywhere Rather than mixing use of WIN32 and _WIN32. --- bootstrap.py | 2 +- configure.py | 2 +- src/build.cc | 4 ++-- src/build_log_test.cc | 4 ++-- src/build_test.cc | 4 ++-- src/disk_interface.cc | 8 ++++---- src/metrics.cc | 4 ++-- src/ninja.cc | 10 +++++----- src/test.cc | 2 +- src/util.cc | 4 ++-- src/util.h | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/bootstrap.py b/bootstrap.py index 0040609..ca47b19 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -65,7 +65,7 @@ if sys.platform.startswith('win32'): vcdir = os.environ.get('VCINSTALLDIR') if vcdir: - args = [os.path.join(vcdir, 'bin', 'cl.exe'), '/nologo', '/EHsc', '/DWIN32'] + args = [os.path.join(vcdir, 'bin', 'cl.exe'), '/nologo', '/EHsc'] else: args = shlex.split(os.environ.get('CXX', 'g++')) args.extend(['-Wno-deprecated', diff --git a/configure.py b/configure.py index 6732c98..be47446 100755 --- a/configure.py +++ b/configure.py @@ -104,7 +104,7 @@ else: if platform == 'windows': cflags = ['/nologo', '/Zi', '/W4', '/WX', '/wd4530', '/wd4100', '/wd4706', '/wd4512', '/wd4800', '/wd4702', - '/D_CRT_SECURE_NO_WARNINGS', '/DWIN32', + '/D_CRT_SECURE_NO_WARNINGS', "/DNINJA_PYTHON=\"%s\"" % (options.with_python,)] ldflags = ['/DEBUG', '/libpath:$builddir'] if not options.debug: diff --git a/src/build.cc b/src/build.cc index 8d0abce..cc877e5 100644 --- a/src/build.cc +++ b/src/build.cc @@ -65,7 +65,7 @@ BuildStatus::BuildStatus(const BuildConfig& config) start_time_millis_(GetTimeMillis()), last_update_millis_(start_time_millis_), started_edges_(0), finished_edges_(0), total_edges_(0) { -#ifndef WIN32 +#ifndef _WIN32 const char* term = getenv("TERM"); smart_terminal_ = isatty(1) && term && string(term) != "dumb"; #else @@ -171,7 +171,7 @@ void BuildStatus::PrintStatus(Edge* edge) { int progress_chars = printf("[%d/%d] ", started_edges_, total_edges_); -#ifndef WIN32 +#ifndef _WIN32 if (smart_terminal_ && !force_full_command) { // Limit output to width of the terminal if provided so we don't cause // line-wrapping. diff --git a/src/build_log_test.cc b/src/build_log_test.cc index 005b929..c6d6bc3 100644 --- a/src/build_log_test.cc +++ b/src/build_log_test.cc @@ -16,7 +16,7 @@ #include "test.h" -#ifdef WIN32 +#ifdef _WIN32 #include #include #endif @@ -102,7 +102,7 @@ TEST_F(BuildLogTest, Truncate) { // For all possible truncations of the input file, assert that we don't // crash or report an error when parsing. for (off_t size = statbuf.st_size; size > 0; --size) { -#ifndef WIN32 +#ifndef _WIN32 ASSERT_EQ(0, truncate(kTestFilename, size)); #else int fh; diff --git a/src/build_test.cc b/src/build_test.cc index 497faa4..0fa23ed 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -418,7 +418,7 @@ TEST_F(BuildTest, MissingTarget) { TEST_F(BuildTest, MakeDirs) { string err; -#ifdef WIN32 +#ifdef _WIN32 ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build subdir\\dir2\\file: cat in1\n")); EXPECT_TRUE(builder_.AddTarget("subdir\\dir2\\file", &err)); #else @@ -432,7 +432,7 @@ TEST_F(BuildTest, MakeDirs) { ASSERT_EQ("", err); ASSERT_EQ(2u, fs_.directories_made_.size()); EXPECT_EQ("subdir", fs_.directories_made_[0]); -#ifdef WIN32 +#ifdef _WIN32 EXPECT_EQ("subdir\\dir2", fs_.directories_made_[1]); #else EXPECT_EQ("subdir/dir2", fs_.directories_made_[1]); diff --git a/src/disk_interface.cc b/src/disk_interface.cc index 8cc7c2c..4e10f4e 100644 --- a/src/disk_interface.cc +++ b/src/disk_interface.cc @@ -19,7 +19,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #endif @@ -28,7 +28,7 @@ namespace { string DirName(const string& path) { -#ifdef WIN32 +#ifdef _WIN32 const char kPathSeparator = '\\'; #else const char kPathSeparator = '/'; @@ -66,8 +66,8 @@ bool DiskInterface::MakeDirs(const string& path) { // RealDiskInterface ----------------------------------------------------------- TimeStamp RealDiskInterface::Stat(const string& path) { -#ifdef WIN32 - WIN32_FILE_ATTRIBUTE_DATA attrs; +#ifdef _WIN32 + _WIN32_FILE_ATTRIBUTE_DATA attrs; if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &attrs)) { DWORD err = GetLastError(); if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) diff --git a/src/metrics.cc b/src/metrics.cc index 1c7b7de..b2433aa 100644 --- a/src/metrics.cc +++ b/src/metrics.cc @@ -18,7 +18,7 @@ #include #include -#ifndef WIN32 +#ifndef _WIN32 #include #else #include @@ -30,7 +30,7 @@ Metrics* g_metrics = NULL; namespace { -#ifndef WIN32 +#ifndef _WIN32 /// Compute a platform-specific high-res timer value that fits into an int64. int64_t HighResTimer() { timeval tv; diff --git a/src/ninja.cc b/src/ninja.cc index b07c759..a599c6e 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -24,7 +24,7 @@ #include #endif -#ifdef WIN32 +#ifdef _WIN32 #include "getopt.h" #include #include @@ -107,7 +107,7 @@ int GuessParallelism() { NULL, 0) < 0) { processors = 1; } -#elif defined(WIN32) +#elif defined(_WIN32) SYSTEM_INFO info; GetSystemInfo(&info); processors = info.dwNumberOfProcessors; @@ -255,7 +255,7 @@ int ToolQuery(Globals* globals, int argc, char* argv[]) { return 0; } -#if !defined(WIN32) && !defined(NINJA_BOOTSTRAP) +#if !defined(_WIN32) && !defined(NINJA_BOOTSTRAP) int ToolBrowse(Globals* globals, int argc, char* argv[]) { if (argc < 1) { Error("expected a target to browse"); @@ -265,7 +265,7 @@ int ToolBrowse(Globals* globals, int argc, char* argv[]) { // If we get here, the browse failed. return 1; } -#endif // WIN32 +#endif // _WIN32 int ToolTargetsList(const vector& nodes, int depth, int indent) { for (vector::const_iterator n = nodes.begin(); @@ -475,7 +475,7 @@ int RunTool(const string& tool, Globals* globals, int argc, char** argv) { const char* desc; ToolFunc func; } tools[] = { -#if !defined(WIN32) && !defined(NINJA_BOOTSTRAP) +#if !defined(_WIN32) && !defined(NINJA_BOOTSTRAP) { "browse", "browse dependency graph in a web browser", ToolBrowse }, #endif diff --git a/src/test.cc b/src/test.cc index 47b7b23..53bd798 100644 --- a/src/test.cc +++ b/src/test.cc @@ -54,7 +54,7 @@ char* mkdtemp(char* name_template) { return name_template; } -#endif // WIN32 +#endif // _WIN32 string GetSystemTempDir() { #ifdef _WIN32 diff --git a/src/util.cc b/src/util.cc index 5f5d8dc..9f538b9 100644 --- a/src/util.cc +++ b/src/util.cc @@ -47,7 +47,7 @@ void Fatal(const char* msg, ...) { vfprintf(stderr, msg, ap); va_end(ap); fprintf(stderr, "\n"); -#ifdef WIN32 +#ifdef _WIN32 // On Windows, some tools may inject extra threads. // exit() may block on locks held by those threads, so forcibly exit. fflush(stderr); @@ -235,7 +235,7 @@ const char* SpellcheckString(const string& text, ...) { return SpellcheckStringV(text, words); } -#ifdef WIN32 +#ifdef _WIN32 string GetLastErrorString() { DWORD err = GetLastError(); diff --git a/src/util.h b/src/util.h index 711d476..c401c30 100644 --- a/src/util.h +++ b/src/util.h @@ -16,7 +16,7 @@ #define NINJA_UTIL_H_ #pragma once -#ifdef WIN32 +#ifdef _WIN32 #include "win32port.h" #else #include -- cgit v0.12