summaryrefslogtreecommitdiffstats
path: root/src/state.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.cc')
-rw-r--r--src/state.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/state.cc b/src/state.cc
index 0a68f21..d4b9a71 100644
--- a/src/state.cc
+++ b/src/state.cc
@@ -133,10 +133,17 @@ void State::AddIn(Edge* edge, StringPiece path, uint64_t slash_bits) {
node->AddOutEdge(edge);
}
-bool State::AddOut(Edge* edge, StringPiece path, uint64_t slash_bits) {
+bool State::AddOut(Edge* edge, StringPiece path, uint64_t slash_bits,
+ std::string* err) {
Node* node = GetNode(path, slash_bits);
- if (node->in_edge())
+ if (Edge* other = node->in_edge()) {
+ if (other == edge) {
+ *err = path.AsString() + " is defined as an output multiple times";
+ } else {
+ *err = "multiple rules generate " + path.AsString();
+ }
return false;
+ }
edge->outputs_.push_back(node);
node->set_in_edge(edge);
node->set_generated_by_dep_loader(false);