Rather than mixing use of WIN32 and _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',
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:
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
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.
#include "test.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <fcntl.h>
#include <share.h>
#endif
// 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;
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
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]);
#include <string.h>
#include <sys/stat.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#endif
namespace {
string DirName(const string& path) {
-#ifdef WIN32
+#ifdef _WIN32
const char kPathSeparator = '\\';
#else
const char kPathSeparator = '/';
// 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)
#include <stdio.h>
#include <string.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/time.h>
#else
#include <windows.h>
namespace {
-#ifndef WIN32
+#ifndef _WIN32
/// Compute a platform-specific high-res timer value that fits into an int64.
int64_t HighResTimer() {
timeval tv;
#include <sys/sysinfo.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include "getopt.h"
#include <direct.h>
#include <windows.h>
NULL, 0) < 0) {
processors = 1;
}
-#elif defined(WIN32)
+#elif defined(_WIN32)
SYSTEM_INFO info;
GetSystemInfo(&info);
processors = info.dwNumberOfProcessors;
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");
// If we get here, the browse failed.
return 1;
}
-#endif // WIN32
+#endif // _WIN32
int ToolTargetsList(const vector<Node*>& nodes, int depth, int indent) {
for (vector<Node*>::const_iterator n = nodes.begin();
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
return name_template;
}
-#endif // WIN32
+#endif // _WIN32
string GetSystemTempDir() {
#ifdef _WIN32
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);
return SpellcheckStringV(text, words);
}
-#ifdef WIN32
+#ifdef _WIN32
string GetLastErrorString() {
DWORD err = GetLastError();
#define NINJA_UTIL_H_
#pragma once
-#ifdef WIN32
+#ifdef _WIN32
#include "win32port.h"
#else
#include <stdint.h>