aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/adhoc-rule-buildscript.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-12-03 09:47:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-12-03 09:47:05 +0200
commit82e9227262a41bfa740952659b3b91d2d99e984e (patch)
treeb0ee458f8cb0fb28ac0aae9b1927331a1d80a94c /libbuild2/adhoc-rule-buildscript.cxx
parentd9745e79083e12a2c3eb129a20fc20be3607a4c3 (diff)
Add depdb-dyndep --drop-cycles option
Diffstat (limited to 'libbuild2/adhoc-rule-buildscript.cxx')
-rw-r--r--libbuild2/adhoc-rule-buildscript.cxx56
1 files changed, 23 insertions, 33 deletions
diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx
index 0648c3d..ea4ab60 100644
--- a/libbuild2/adhoc-rule-buildscript.cxx
+++ b/libbuild2/adhoc-rule-buildscript.cxx
@@ -582,28 +582,6 @@ namespace build2
fp, true /* cache */, true /* normalized */,
map_ext, *byp.default_type).first)
{
- // Skip if this is one of the static prerequisites.
- //
- for (size_t i (0); i != pts_n; ++i)
- {
- const prerequisite_target& p (pts[i]);
-
- if (const target* pt =
- (p.target != nullptr ? p.target :
- p.data != 0 ? reinterpret_cast<target*> (p.data) :
- nullptr))
- {
- if (pt == ft)
- {
- // Note that we have to increment the skip count since we
- // skip before performing this test.
- //
- skip_count++;
- return false;
- }
- }
- }
-
if (optional<bool> u = dyndep::inject_existing_file (
trace, what,
a, t,
@@ -826,9 +804,11 @@ namespace build2
//
// Note that fp is expected to be absolute.
//
+ size_t skip (md.skip_count);
+
auto add = [&trace, what,
a, &bs, &t, &pts, pts_n = md.pts_n,
- &byp, &map_ext, &dd] (path fp)
+ &byp, &map_ext, &dd, &skip] (path fp)
{
normalize_external (fp, what);
@@ -849,11 +829,30 @@ namespace build2
p.data != 0 ? reinterpret_cast<target*> (p.data) :
nullptr))
{
- if (pt == ft)
+ if (ft == pt)
+ return;
+ }
+ }
+
+ // Skip if this is one of the targets.
+ //
+ if (byp.drop_cycles)
+ {
+ for (const target* m (&t); m != nullptr; m = m->adhoc_member)
+ {
+ if (ft == m)
return;
}
}
+ // Skip until where we left off.
+ //
+ if (skip != 0)
+ {
+ --skip;
+ return;
+ }
+
// Verify it has noop recipe.
//
dyndep::verify_existing_file (trace, what, a, t, *ft);
@@ -881,7 +880,6 @@ namespace build2
}
location il (file, 1);
- size_t skip (md.skip_count);
// The way we parse things is format-specific.
//
@@ -924,14 +922,6 @@ namespace build2
if (r.first == make_type::target)
continue;
- // Skip until where we left off.
- //
- if (skip != 0)
- {
- skip--;
- continue;
- }
-
path f (move (r.second));
if (f.relative ())