summaryrefslogtreecommitdiff
path: root/ninja/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-10-24 11:14:28 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-10-24 11:16:04 +0000
commit466052c4e7c052268fd931888cd58961da94c586 (patch)
tree9fdfe5d31e40a04011e70116baf7820ab0fe185a /ninja/src
parentc69fdae9c762b7bdf45016bf8398f6050b7699ba (diff)
downloadqtwebengine-chromium-466052c4e7c052268fd931888cd58961da94c586.tar.gz
BASELINE: Update Chromium to 69.0.3497.128
Change-Id: I165861e67c89a7d3a77401d1faf3ec83920c36f8 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'ninja/src')
-rw-r--r--ninja/src/build_log.cc4
-rw-r--r--ninja/src/deps_log.cc21
-rw-r--r--ninja/src/deps_log.h8
-rw-r--r--ninja/src/disk_interface.cc21
-rw-r--r--ninja/src/graph.cc8
-rw-r--r--ninja/src/ninja.cc8
-rw-r--r--ninja/src/timestamp.h15
-rw-r--r--ninja/src/version.cc2
-rw-r--r--ninja/src/win32port.h8
9 files changed, 30 insertions, 65 deletions
diff --git a/ninja/src/build_log.cc b/ninja/src/build_log.cc
index 648617c8e79..333915af9f9 100644
--- a/ninja/src/build_log.cc
+++ b/ninja/src/build_log.cc
@@ -290,7 +290,7 @@ bool BuildLog::Load(const string& path, string* err) {
if (!end)
continue;
*end = 0;
- restat_mtime = strtoll(start, NULL, 10);
+ restat_mtime = atol(start);
start = end + 1;
end = (char*)memchr(start, kFieldSeparator, line_end - start);
@@ -353,7 +353,7 @@ BuildLog::LogEntry* BuildLog::LookupByOutput(const string& path) {
}
bool BuildLog::WriteEntry(FILE* f, const LogEntry& entry) {
- return fprintf(f, "%d\t%d\t%" PRId64 "\t%s\t%" PRIx64 "\n",
+ return fprintf(f, "%d\t%d\t%d\t%s\t%" PRIx64 "\n",
entry.start_time, entry.end_time, entry.mtime,
entry.output.c_str(), entry.command_hash) > 0;
}
diff --git a/ninja/src/deps_log.cc b/ninja/src/deps_log.cc
index eb81a376f4c..89c60232b7b 100644
--- a/ninja/src/deps_log.cc
+++ b/ninja/src/deps_log.cc
@@ -30,7 +30,7 @@
// The version is stored as 4 bytes after the signature and also serves as a
// byte order mark. Signature and version combined are 16 bytes long.
const char kFileSignature[] = "# ninjadeps\n";
-const int kCurrentVersion = 4;
+const int kCurrentVersion = 3;
// Record size is currently limited to less than the full 32 bit, due to
// internal buffers having to have this size.
@@ -124,7 +124,7 @@ bool DepsLog::RecordDeps(Node* node, TimeStamp mtime,
return true;
// Update on-disk representation.
- unsigned size = 4 * (1 + 2 + node_count);
+ unsigned size = 4 * (1 + 1 + node_count);
if (size > kMaxRecordSize) {
errno = ERANGE;
return false;
@@ -135,11 +135,8 @@ bool DepsLog::RecordDeps(Node* node, TimeStamp mtime,
int id = node->id();
if (fwrite(&id, 4, 1, file_) < 1)
return false;
- uint32_t mtime_part = static_cast<uint32_t>(mtime & 0xffffffff);
- if (fwrite(&mtime_part, 4, 1, file_) < 1)
- return false;
- mtime_part = static_cast<uint32_t>((mtime >> 32) & 0xffffffff);
- if (fwrite(&mtime_part, 4, 1, file_) < 1)
+ int timestamp = mtime;
+ if (fwrite(&timestamp, 4, 1, file_) < 1)
return false;
for (int i = 0; i < node_count; ++i) {
id = nodes[i]->id();
@@ -212,7 +209,7 @@ bool DepsLog::Load(const string& path, State* state, string* err) {
bool is_deps = (size >> 31) != 0;
size = size & 0x7FFFFFFF;
- if (size > kMaxRecordSize || fread(buf, size, 1, f) < 1) {
+ if (fread(buf, size, 1, f) < 1 || size > kMaxRecordSize) {
read_failed = true;
break;
}
@@ -221,11 +218,9 @@ bool DepsLog::Load(const string& path, State* state, string* err) {
assert(size % 4 == 0);
int* deps_data = reinterpret_cast<int*>(buf);
int out_id = deps_data[0];
- TimeStamp mtime;
- mtime = (TimeStamp)(((uint64_t)(unsigned int)deps_data[2] << 32) |
- (uint64_t)(unsigned int)deps_data[1]);
- deps_data += 3;
- int deps_count = (size / 4) - 3;
+ int mtime = deps_data[1];
+ deps_data += 2;
+ int deps_count = (size / 4) - 2;
Deps* deps = new Deps(mtime, deps_count);
for (int i = 0; i < deps_count; ++i) {
diff --git a/ninja/src/deps_log.h b/ninja/src/deps_log.h
index 3812a28a80c..cec0257ceff 100644
--- a/ninja/src/deps_log.h
+++ b/ninja/src/deps_log.h
@@ -57,9 +57,7 @@ struct State;
/// one's complement of the expected index of the record (to detect
/// concurrent writes of multiple ninja processes to the log).
/// dependency records are an array of 4-byte integers
-/// [output path id,
-/// output path mtime (lower 4 bytes), output path mtime (upper 4 bytes),
-/// input path id, input path id...]
+/// [output path id, output path mtime, input path id, input path id...]
/// (The mtime is compared against the on-disk output path mtime
/// to verify the stored data is up-to-date.)
/// If two records reference the same output the latter one in the file
@@ -77,10 +75,10 @@ struct DepsLog {
// Reading (startup-time) interface.
struct Deps {
- Deps(int64_t mtime, int node_count)
+ Deps(int mtime, int node_count)
: mtime(mtime), node_count(node_count), nodes(new Node*[node_count]) {}
~Deps() { delete [] nodes; }
- TimeStamp mtime;
+ int mtime;
int node_count;
Node** nodes;
};
diff --git a/ninja/src/disk_interface.cc b/ninja/src/disk_interface.cc
index 4b4c4c76113..28530b19d0d 100644
--- a/ninja/src/disk_interface.cc
+++ b/ninja/src/disk_interface.cc
@@ -61,11 +61,12 @@ int MakeDir(const string& path) {
TimeStamp TimeStampFromFileTime(const FILETIME& filetime) {
// FILETIME is in 100-nanosecond increments since the Windows epoch.
// We don't much care about epoch correctness but we do want the
- // resulting value to fit in a 64-bit integer.
+ // resulting value to fit in an integer.
uint64_t mtime = ((uint64_t)filetime.dwHighDateTime << 32) |
((uint64_t)filetime.dwLowDateTime);
- // 1600 epoch -> 2000 epoch (subtract 400 years).
- return (TimeStamp)mtime - 12622770400LL * (1000000000LL / 100);
+ mtime /= 1000000000LL / 100; // 100ns -> s.
+ mtime -= 12622770400LL; // 1600 epoch -> 2000 epoch (subtract 400 years).
+ return (TimeStamp)mtime;
}
TimeStamp StatSingleFile(const string& path, string* err) {
@@ -191,19 +192,7 @@ TimeStamp RealDiskInterface::Stat(const string& path, string* err) const {
// that it doesn't exist.
if (st.st_mtime == 0)
return 1;
-#if defined(__APPLE__) && !defined(_POSIX_C_SOURCE)
- return ((int64_t)st.st_mtimespec.tv_sec * 1000000000LL +
- st.st_mtimespec.tv_nsec);
-#elif (_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700 || defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || \
- defined(__BIONIC__))
- // For glibc, see "Timestamp files" in the Notes of http://www.kernel.org/doc/man-pages/online/pages/man2/stat.2.html
- // newlib, uClibc and musl follow the kernel (or Cygwin) headers and define the right macro values above.
- // For bsd, see https://github.com/freebsd/freebsd/blob/master/sys/sys/stat.h and similar
- // For bionic, C and POSIX API is always enabled.
- return (int64_t)st.st_mtim.tv_sec * 1000000000LL + st.st_mtim.tv_nsec;
-#else
- return (int64_t)st.st_mtime * 1000000000LL + st.st_mtimensec;
-#endif
+ return st.st_mtime;
#endif
}
diff --git a/ninja/src/graph.cc b/ninja/src/graph.cc
index b41c247912a..ce4ea774f24 100644
--- a/ninja/src/graph.cc
+++ b/ninja/src/graph.cc
@@ -233,7 +233,7 @@ bool DependencyScan::RecomputeOutputDirty(Edge* edge,
if (output_mtime < most_recent_input->mtime()) {
EXPLAIN("%soutput %s older than most recent input %s "
- "(%" PRId64 " vs %" PRId64 ")",
+ "(%d vs %d)",
used_restat ? "restat of " : "", output->path().c_str(),
most_recent_input->path().c_str(),
output_mtime, most_recent_input->mtime());
@@ -257,7 +257,7 @@ bool DependencyScan::RecomputeOutputDirty(Edge* edge,
// mtime of the most recent input. This can occur even when the mtime
// on disk is newer if a previous run wrote to the output file but
// exited with an error or was interrupted.
- EXPLAIN("recorded mtime of %s older than most recent input %s (%" PRId64 " vs %" PRId64 ")",
+ EXPLAIN("recorded mtime of %s older than most recent input %s (%d vs %d)",
output->path().c_str(), most_recent_input->path().c_str(),
entry->mtime, most_recent_input->mtime());
return true;
@@ -441,7 +441,7 @@ string Node::PathDecanonicalized(const string& path, uint64_t slash_bits) {
}
void Node::Dump(const char* prefix) const {
- printf("%s <%s 0x%p> mtime: %" PRId64 "%s, (:%s), ",
+ printf("%s <%s 0x%p> mtime: %d%s, (:%s), ",
prefix, path().c_str(), this,
mtime(), mtime() ? "" : " (:missing)",
dirty() ? " dirty" : " clean");
@@ -547,7 +547,7 @@ bool ImplicitDepLoader::LoadDepsFromLog(Edge* edge, string* err) {
// Deps are invalid if the output is newer than the deps.
if (output->mtime() > deps->mtime) {
- EXPLAIN("stored deps info out of date for '%s' (%" PRId64 " vs %" PRId64 ")",
+ EXPLAIN("stored deps info out of date for '%s' (%d vs %d)",
output->path().c_str(), deps->mtime, output->mtime());
return false;
}
diff --git a/ninja/src/ninja.cc b/ninja/src/ninja.cc
index 30f89c27f65..ed004ac8f1f 100644
--- a/ninja/src/ninja.cc
+++ b/ninja/src/ninja.cc
@@ -212,10 +212,10 @@ void Usage(const BuildConfig& config) {
" -n dry run (don't run commands but act like they succeeded)\n"
" -v show all command lines while building\n"
"\n"
-" -d MODE enable debugging (use '-d list' to list modes)\n"
-" -t TOOL run a subtool (use '-t list' to list subtools)\n"
+" -d MODE enable debugging (use -d list to list modes)\n"
+" -t TOOL run a subtool (use -t list to list subtools)\n"
" terminates toplevel options; further flags are passed to the tool\n"
-" -w FLAG adjust warnings (use '-w list' to list warnings)\n",
+" -w FLAG adjust warnings (use -w list to list warnings)\n",
kNinjaVersion, config.parallelism);
}
@@ -494,7 +494,7 @@ int NinjaMain::ToolDeps(const Options* options, int argc, char** argv) {
TimeStamp mtime = disk_interface.Stat((*it)->path(), &err);
if (mtime == -1)
Error("%s", err.c_str()); // Log and ignore Stat() errors;
- printf("%s: #deps %d, deps mtime %" PRId64 " (%s)\n",
+ printf("%s: #deps %d, deps mtime %d (%s)\n",
(*it)->path().c_str(), deps->node_count, deps->mtime,
(!mtime || mtime > deps->mtime ? "STALE":"VALID"));
for (int i = 0; i < deps->node_count; ++i)
diff --git a/ninja/src/timestamp.h b/ninja/src/timestamp.h
index 6a7ccd0b068..cee7ba8f21b 100644
--- a/ninja/src/timestamp.h
+++ b/ninja/src/timestamp.h
@@ -15,19 +15,10 @@
#ifndef NINJA_TIMESTAMP_H_
#define NINJA_TIMESTAMP_H_
-#ifdef _WIN32
-#include "win32port.h"
-#else
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS
-#endif
-#include <inttypes.h>
-#endif
-
// When considering file modification times we only care to compare
// them against one another -- we never convert them to an absolute
-// real time. On POSIX we use timespec (seconds&nanoseconds since epoch)
-// and on Windows we use a different value. Both fit in an int64.
-typedef int64_t TimeStamp;
+// real time. On POSIX we use time_t (seconds since epoch) and on
+// Windows we use a different value. Both fit in an int.
+typedef int TimeStamp;
#endif // NINJA_TIMESTAMP_H_
diff --git a/ninja/src/version.cc b/ninja/src/version.cc
index 1b6cfac9b71..3a20205cd88 100644
--- a/ninja/src/version.cc
+++ b/ninja/src/version.cc
@@ -18,7 +18,7 @@
#include "util.h"
-const char* kNinjaVersion = "1.8.2.git";
+const char* kNinjaVersion = "1.8.2";
void ParseVersion(const string& version, int* major, int* minor) {
size_t end = version.find('.');
diff --git a/ninja/src/win32port.h b/ninja/src/win32port.h
index e542536cc76..ce3c9498e5d 100644
--- a/ninja/src/win32port.h
+++ b/ninja/src/win32port.h
@@ -15,13 +15,6 @@
#ifndef NINJA_WIN32PORT_H_
#define NINJA_WIN32PORT_H_
-#if defined(__MINGW32__) || defined(__MINGW64__)
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS
-#endif
-#include <inttypes.h>
-#endif
-
typedef signed short int16_t;
typedef unsigned short uint16_t;
/// A 64-bit integer type
@@ -30,7 +23,6 @@ typedef unsigned long long uint64_t;
// printf format specifier for uint64_t, from C99.
#ifndef PRIu64
-#define PRId64 "I64d"
#define PRIu64 "I64u"
#define PRIx64 "I64x"
#endif