From c2001eb367b9b82e26689cad6f1f74f46c72b904 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 27 Apr 2017 08:29:52 +0200 Subject: Pass target to prerequisite search --- build2/cc/compile.cxx | 12 ++++++------ build2/cc/install.cxx | 2 +- build2/cc/link.cxx | 12 ++++++------ build2/cc/target.cxx | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'build2/cc') diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 67d254b..c5ef480 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -321,7 +321,7 @@ namespace build2 continue; } - pt = &p.search (); + pt = &p.search (t); if (const lib* l = pt->is_a ()) pt = &link_member (*l, act, lo); @@ -331,7 +331,7 @@ namespace build2 } else { - pt = &p.search (); + pt = &p.search (t); if (act.operation () == clean_id && !pt->dir.sub (rs.out_path ())) continue; @@ -375,7 +375,7 @@ namespace build2 // t.prerequisite_targets since we used standard search() and match() // above. // - const file& src (*md.src.search ().is_a ()); + const file& src (*md.src.search (t).is_a ()); // Make sure the output directory exists. // @@ -993,12 +993,12 @@ namespace build2 // from the depdb cache or from the compiler run. Return whether the // extraction process should be restarted. // - auto add = [&trace, &update, &pm, act, &t, lo, &dd, &bs, this] + auto add = [&trace, &update, &pm, act, &t, lo, &dd, &bs, &t, this] (path f, bool cache) -> bool { // Find or maybe insert the target. // - auto find = [&trace, this] ( + auto find = [&trace, &t, this] ( const path& f, bool insert) -> const path_target* { // Split the name into its directory part, the name part, and @@ -1059,7 +1059,7 @@ namespace build2 // const target* r; if (insert) - r = &search (*tt, d, out, n, &e, nullptr); + r = &search (t, *tt, d, out, n, &e, nullptr); else { // Note that we skip any target type-specific searches (like for diff --git a/build2/cc/install.cxx b/build2/cc/install.cxx index 6195ab7..e1e5719 100644 --- a/build2/cc/install.cxx +++ b/build2/cc/install.cxx @@ -42,7 +42,7 @@ namespace build2 if ((t.is_a () || t.is_a ()) && (p.is_a () || p.is_a ())) { - const target* pt (&p.search ()); + const target* pt (&p.search (t)); // If this is the lib{} group, pick a member which we would link. // diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx index 6d0c605..b15f340 100644 --- a/build2/cc/link.cxx +++ b/build2/cc/link.cxx @@ -306,7 +306,7 @@ namespace build2 const target& m (t.member != nullptr // Might already be there. ? *t.member - : search (tt, t.dir, t.out, t.name)); + : search (t, tt, t.dir, t.out, t.name)); target_lock l (lock (act, m)); assert (l.target != nullptr); // Someone messing with adhoc members? @@ -438,7 +438,7 @@ namespace build2 // The rest is the same basic logic as in search_and_match(). // if (pt == nullptr) - pt = &p.search (); + pt = &p.search (t); if (act.operation () == clean_id && !pt->dir.sub (rs.out_path ())) continue; // Skip. @@ -486,7 +486,7 @@ namespace build2 // If this is the obj{} target group, then pick the appropriate // member. // - pt = p.is_a () ? &search (ott, p.key ()) : &p.search (); + pt = p.is_a () ? &search (t, ott, p.key ()) : &p.search (t); if (act.operation () == clean_id && !pt->dir.sub (rs.out_path ())) continue; // Skip. @@ -539,7 +539,7 @@ namespace build2 // obj*{} is always in the out tree. // const target& ot ( - search (tt, d, dir_path (), *cp.tk.name, nullptr, cp.scope)); + search (t, tt, d, dir_path (), *cp.tk.name, nullptr, cp.scope)); // If we are cleaning, check that this target is in the same or a // subdirectory of our project root. @@ -557,7 +557,7 @@ namespace build2 // If we have created the obj{} target group, pick one of its // members; the rest would be primarily concerned with it. // - pt = group ? &search (ott, ot.dir, ot.out, ot.name) : &ot; + pt = group ? &search (t, ott, ot.dir, ot.out, ot.name) : &ot; // If this obj*{} already has prerequisites, then verify they are // "compatible" with what we are doing here. Otherwise, synthesize @@ -699,7 +699,7 @@ namespace build2 // Searching our own prerequisite is ok, p1 must already be // resolved. // - if (&p.search () != &p1.search ()) + if (&p.search (t) != &p1.search (*pt)) fail << "synthesized dependency for prerequisite " << p << " " << "would be incompatible with existing target " << *pt << info << "existing prerequisite " << p1 << " does not match " diff --git a/build2/cc/target.cxx b/build2/cc/target.cxx index f269b35..a734953 100644 --- a/build2/cc/target.cxx +++ b/build2/cc/target.cxx @@ -18,7 +18,7 @@ namespace build2 nullptr, nullptr, nullptr, - &search_target, + &target_search, false }; @@ -33,7 +33,7 @@ namespace build2 &target_extension_var, &target_pattern_var, nullptr, - &search_file, + &file_search, false }; @@ -46,7 +46,7 @@ namespace build2 &target_extension_var, &target_pattern_var, nullptr, - &search_file, + &file_search, false }; } -- cgit v1.1