From a84ff43b183181e0a12c6d5e31c1f366d39ce2fe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 31 Jul 2017 18:42:47 +0200 Subject: Experimental (and probably broken) pkg-config generation support --- build2/algorithm.cxx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'build2/algorithm.cxx') diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index dc1c418..29bae6d 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -262,19 +262,20 @@ namespace build2 n += s; } - const target& m (t.member != nullptr // Might already be there. - ? *t.member + const_ptr* mp (&t.member); + for (auto p (*mp); p != nullptr && !p->is_a (tt); mp = &p->member) ; + + const target& m (*mp != nullptr // Might already be there. + ? **mp : search (t, tt, t.dir, t.out, n)); target_lock l (lock (a, m)); assert (l.target != nullptr); // Someone messing with ad hoc members? - if (t.member == nullptr) - t.member = l.target; + if (*mp == nullptr) + *mp = l.target; else - // Basic sanity check. - // - assert (t.member->type () == tt && t.member->name == n); + assert ((*mp)->name == n); // Basic sanity check. return l; }; @@ -513,7 +514,7 @@ namespace build2 catch (const failed&) { // As a sanity measure clear the target data since it can be incomplete - // or invalid (mark()/unmark() should give you some for ideas). + // or invalid (mark()/unmark() should give you some ideas). // t.clear_data (); t.prerequisite_targets.clear (); @@ -619,6 +620,10 @@ namespace build2 // Fall through to apply. } + // @@ Doing match without execute messes up our target_count. Does + // not seem like it will be easy to fix (we don't know whether + // someone else will execute this target). + // case target::offset_matched: { // Apply (locked). @@ -1234,7 +1239,7 @@ namespace build2 noop_action (action a, const target& t) { text << "noop action triggered for " << diag_doing (a, t); - assert (false); // We shouldn't be called, see target::recipe(). + assert (false); // We shouldn't be called (see target::recipe()). return target_state::unchanged; } -- cgit v1.1