aboutsummaryrefslogtreecommitdiff
path: root/build2/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-04-17 13:42:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-04-17 13:42:37 +0200
commitca0f9c71be279aee845bf5328ac0af8c02c8849e (patch)
treef8e5ccf1722a90895af7aef36e775fac0088ee7e /build2/algorithm.cxx
parent9f537aca20984524a442e4829e5bba2e9f0df91b (diff)
Incorporate ad hoc prerequisite mtime into out-of-date determination
Diffstat (limited to 'build2/algorithm.cxx')
-rw-r--r--build2/algorithm.cxx35
1 files changed, 18 insertions, 17 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index 06ed922..fc72d74 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -1605,19 +1605,16 @@ namespace build2
return t.executed_state (a);
}
- static inline bool
- adhoc_member (const target*&)
+ static inline void
+ blank_adhoc_member (const target*&)
{
- return false;
}
- static inline bool
- adhoc_member (prerequisite_target& pt)
+ static inline void
+ blank_adhoc_member (prerequisite_target& pt)
{
if (pt.adhoc)
pt.target = nullptr;
-
- return pt.adhoc;
}
template <typename T>
@@ -1669,7 +1666,7 @@ namespace build2
r |= mt.executed_state (a);
- adhoc_member (ts[i]);
+ blank_adhoc_member (ts[i]);
}
return r;
@@ -1718,7 +1715,7 @@ namespace build2
r |= mt.executed_state (a);
- adhoc_member (ts[i]);
+ blank_adhoc_member (ts[i]);
}
return r;
@@ -1786,10 +1783,12 @@ namespace build2
for (size_t i (0); i != n; ++i)
{
- if (pts[i] == nullptr)
+ prerequisite_target& p (pts[i]);
+
+ if (p == nullptr)
continue;
- const target& pt (*pts[i]);
+ const target& pt (*p.target);
const auto& tc (pt[a].task_count);
if (tc.load (memory_order_acquire) >= target::count_busy ())
@@ -1800,7 +1799,7 @@ namespace build2
// Should we compare the timestamp to this target's?
//
- if (!e && (!ef || ef (pt, i)))
+ if (!e && (p.adhoc || !ef || ef (pt, i)))
{
// If this is an mtime-based target, then compare timestamps.
//
@@ -1823,11 +1822,13 @@ namespace build2
}
}
- if (adhoc_member (pts[i]))
- continue;
-
- if (rt == nullptr && pt.is_a (*tt))
- rt = &pt;
+ if (p.adhoc)
+ p.target = nullptr; // Blank out.
+ else
+ {
+ if (rt == nullptr && pt.is_a (*tt))
+ rt = &pt;
+ }
}
assert (rt != nullptr);