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)) {
+ 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
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) {
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