Add better warning output for stale output files

I'm running into this warning in some unexpected cases, so provide some
extra information when it hits.

Test: ninja_tests (run by build_prebuilts.sh)
Change-Id: I294cf0d38dad3324d7fc697bff94356f07f3df13
diff --git a/src/build.cc b/src/build.cc
index 5a7221d..ad5d409 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -603,13 +603,16 @@
     vector<Node*> nodes_cleaned;
 
     TimeStamp newest_input = 0;
+    Node* newest_input_node = nullptr;
     for (vector<Node*>::iterator i = edge->inputs_.begin();
          i != edge->inputs_.end() - edge->order_only_deps_; ++i) {
       TimeStamp input_mtime = (*i)->mtime();
       if (input_mtime == -1)
         return false;
-      if (input_mtime > newest_input)
+      if (input_mtime > newest_input) {
         newest_input = input_mtime;
+        newest_input_node = (*i);
+      }
     }
 
     for (vector<Node*>::iterator o = edge->outputs_.begin();
@@ -631,8 +634,10 @@
         } else if (!restat && new_mtime < newest_input) {
           if (!result->output.empty())
             result->output.append("\n");
-          result->output.append("ninja: Missing `restat`? An output file is older than the most recent input: ");
+          result->output.append("ninja: Missing `restat`? An output file is older than the most recent input:\n output: ");
           result->output.append((*o)->path());
+          result->output.append("\n  input: ");
+          result->output.append(newest_input_node->path());
           if (config_.old_output_should_err) {
             result->status = ExitFailure;
           }
diff --git a/src/build_test.cc b/src/build_test.cc
index 2400f18..e7b0e55 100644
--- a/src/build_test.cc
+++ b/src/build_test.cc
@@ -2573,7 +2573,7 @@
   EXPECT_TRUE(builder.Build(&err));
   EXPECT_EQ("", err);
 
-  EXPECT_EQ("ninja: Missing `restat`? An output file is older than the most recent input: out", status_.last_output_);
+  EXPECT_EQ("ninja: Missing `restat`? An output file is older than the most recent input:\n output: out\n  input: in", status_.last_output_);
 
   builder.command_runner_.release();
 }
@@ -2609,7 +2609,7 @@
   EXPECT_FALSE(builder.Build(&err));
   EXPECT_EQ("subcommand failed", err);
 
-  EXPECT_EQ("ninja: Missing `restat`? An output file is older than the most recent input: out", status_.last_output_);
+  EXPECT_EQ("ninja: Missing `restat`? An output file is older than the most recent input:\n output: out\n  input: in", status_.last_output_);
 
   builder.command_runner_.release();
 }