summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-03-24 02:51:35 (GMT)
committerNico Weber <nicolasweber@gmx.de>2015-03-24 02:51:35 (GMT)
commit30dbcb62168a494c1c172ddbe8dbad2ae3a561d6 (patch)
tree91a72945cd3a07ebe6321d9fe6b516c05030621a
parentda1be5ece1f164ec6087aafe4efb0084c474afea (diff)
parentd209733d66b5e537e2522891c51d34b5262b4de9 (diff)
downloadNinja-30dbcb62168a494c1c172ddbe8dbad2ae3a561d6.zip
Ninja-30dbcb62168a494c1c172ddbe8dbad2ae3a561d6.tar.gz
Ninja-30dbcb62168a494c1c172ddbe8dbad2ae3a561d6.tar.bz2
Merge pull request #943 from nico/ssshh
Make tests quiet again, and prepare for making duplicate build edges an error.
-rw-r--r--src/manifest_parser.cc11
-rw-r--r--src/manifest_parser.h2
-rw-r--r--src/state.cc12
-rw-r--r--src/state.h2
4 files changed, 16 insertions, 11 deletions
diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc
index b747ad4..638d751 100644
--- a/src/manifest_parser.cc
+++ b/src/manifest_parser.cc
@@ -25,7 +25,7 @@
#include "version.h"
ManifestParser::ManifestParser(State* state, FileReader* file_reader)
- : state_(state), file_reader_(file_reader) {
+ : state_(state), file_reader_(file_reader), quiet_(false) {
env_ = &state->bindings_;
}
@@ -328,7 +328,14 @@ bool ManifestParser::ParseEdge(string* err) {
unsigned int slash_bits;
if (!CanonicalizePath(&path, &slash_bits, &path_err))
return lexer_.Error(path_err, err);
- state_->AddOut(edge, path, slash_bits);
+ if (!state_->AddOut(edge, path, slash_bits)) {
+ if (!quiet_) {
+ Warning("multiple rules generate %s. "
+ "builds involving this target will not be correct; "
+ "continuing anyway",
+ path.c_str());
+ }
+ }
}
if (edge->outputs_.empty()) {
// All outputs of the edge are already created by other edges. Don't add
diff --git a/src/manifest_parser.h b/src/manifest_parser.h
index 5212f72..00a711d 100644
--- a/src/manifest_parser.h
+++ b/src/manifest_parser.h
@@ -39,6 +39,7 @@ struct ManifestParser {
/// Parse a text string of input. Used by tests.
bool ParseTest(const string& input, string* err) {
+ quiet_ = true;
return Parse("input", input, err);
}
@@ -64,6 +65,7 @@ private:
BindingEnv* env_;
FileReader* file_reader_;
Lexer lexer_;
+ bool quiet_;
};
#endif // NINJA_MANIFEST_PARSER_H_
diff --git a/src/state.cc b/src/state.cc
index 0426b85..a70f211 100644
--- a/src/state.cc
+++ b/src/state.cc
@@ -140,17 +140,13 @@ void State::AddIn(Edge* edge, StringPiece path, unsigned int slash_bits) {
node->AddOutEdge(edge);
}
-void State::AddOut(Edge* edge, StringPiece path, unsigned int slash_bits) {
+bool State::AddOut(Edge* edge, StringPiece path, unsigned int slash_bits) {
Node* node = GetNode(path, slash_bits);
- if (node->in_edge()) {
- Warning("multiple rules generate %s. "
- "builds involving this target will not be correct; "
- "continuing anyway",
- path.AsString().c_str());
- return;
- }
+ if (node->in_edge())
+ return false;
edge->outputs_.push_back(node);
node->set_in_edge(edge);
+ return true;
}
bool State::AddDefault(StringPiece path, string* err) {
diff --git a/src/state.h b/src/state.h
index db0e3aa..5000138 100644
--- a/src/state.h
+++ b/src/state.h
@@ -97,7 +97,7 @@ struct State {
Node* SpellcheckNode(const string& path);
void AddIn(Edge* edge, StringPiece path, unsigned int slash_bits);
- void AddOut(Edge* edge, StringPiece path, unsigned int slash_bits);
+ bool AddOut(Edge* edge, StringPiece path, unsigned int slash_bits);
bool AddDefault(StringPiece path, string* error);
/// Reset state. Keeps all nodes and edges, but restores them to the