summaryrefslogtreecommitdiffstats
path: root/src/build.cc
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-02-03 18:20:00 (GMT)
committerBrad King <brad.king@kitware.com>2016-02-03 18:42:18 (GMT)
commit858386d8415d2ee932fe3c01ebfbe5e0737f94a3 (patch)
tree794bd049a0217fda35c9dd3be483cca03cd3367b /src/build.cc
parentf9487ac7971a668ddf142d5adc741f789c7bbb68 (diff)
downloadNinja-858386d8415d2ee932fe3c01ebfbe5e0737f94a3.zip
Ninja-858386d8415d2ee932fe3c01ebfbe5e0737f94a3.tar.gz
Ninja-858386d8415d2ee932fe3c01ebfbe5e0737f94a3.tar.bz2
Expose more details in FileReader::ReadFile signature
Return a status so callers can distinguish a missing file from an empty file. This allows our VirtualFileSystem test infrastructure to report as missing any file for which it has no entry.
Diffstat (limited to 'src/build.cc')
-rw-r--r--src/build.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/build.cc b/src/build.cc
index ab2460a..45d3f32 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -871,9 +871,17 @@ bool Builder::ExtractDeps(CommandRunner::Result* result,
return false;
}
- string content = disk_interface_->ReadFile(depfile, err);
- if (!err->empty())
+ // Read depfile content. Treat a missing depfile as empty.
+ string content;
+ switch (disk_interface_->ReadFile(depfile, &content, err)) {
+ case DiskInterface::Okay:
+ break;
+ case DiskInterface::NotFound:
+ err->clear();
+ break;
+ case DiskInterface::OtherError:
return false;
+ }
if (content.empty())
return true;