diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-11-22 10:03:27 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-11-22 10:03:27 +0200 |
commit | 04c2bf359f9065300808ff389c06aa0811e7376b (patch) | |
tree | 00082d3eb1248e70345b5765271da3c1cbdb10f7 | |
parent | 4ad1a241281d3e8fd0b28388c0191c044ac3d788 (diff) |
Fix bug in dependency chain logic
-rw-r--r-- | build2/parser.cxx | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx index c0b0936..4a0c178 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -894,19 +894,24 @@ namespace build2 // Now enter each prerequisite into each target. // - for (auto& pn: pns) + for (name& pn: pns) { - auto rp (scope_->find_target_type (pn, ploc)); + // We cannot reuse the names if we (potentially) may need to pass them + // as targets in case of a chain (see below). + // + name n (tt != type::colon ? move (pn) : pn); + + auto rp (scope_->find_target_type (n, ploc)); const target_type* tt (rp.first); optional<string>& e (rp.second); if (tt == nullptr) - fail (ploc) << "unknown target type " << pn.type; + fail (ploc) << "unknown target type " << n.type; // Current dir collapses to an empty one. // - if (!pn.dir.empty ()) - pn.dir.normalize (false, true); + if (!n.dir.empty ()) + n.dir.normalize (false, true); // @@ OUT: for now we assume the prerequisite's out is undetermined. The // only way to specify an src prerequisite will be with the explicit @@ -917,14 +922,11 @@ namespace build2 // a special indicator. Also, one can easily and natually suppress any // searches by specifying the absolute path. // - // Note: we cannot move values out of pn since we may need to pass them - // as targets in case of a chain (see below). - // - prerequisite p (pn.proj, + prerequisite p (move (n.proj), *tt, - pn.dir, + move (n.dir), dir_path (), - pn.value, + move (n.value), move (e), *scope_); @@ -1057,8 +1059,8 @@ namespace build2 attributes_pop (); // Note that we could have "pre-resolved" these prerequisites to actual - // targets or, at least, made they directories absolute. We don't do it - // for easy of documentation: with the current semantics we can just say + // targets or, at least, made their directories absolute. We don't do it + // for ease of documentation: with the current semantics we can just say // that the dependency chain is equivalent to specifying each dependency // separately. // |