aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-15 12:38:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-15 12:38:50 +0200
commit75313e6fead3b82a4be2d37b341a735f7b61279b (patch)
treef70086f978fb017bae21ece103d37eaddaaedf52
parent43e66db85be91716b469bef435328d4243b536b7 (diff)
Add sanity check
-rw-r--r--build2/algorithm.cxx2
-rw-r--r--build2/target.hxx2
-rw-r--r--build2/target.ixx2
3 files changed, 5 insertions, 1 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index 6743907..7e68a36 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -439,6 +439,8 @@ namespace build2
const rule_match* r (match_impl (a, t, nullptr, try_match));
+ assert (l.offset != target::offset_tried); // Should have failed.
+
if (r == nullptr) // Not found (try_match == true).
{
l.offset = target::offset_tried;
diff --git a/build2/target.hxx b/build2/target.hxx
index e4f65ff..761cb4e 100644
--- a/build2/target.hxx
+++ b/build2/target.hxx
@@ -507,7 +507,7 @@ namespace build2
protected:
// Version that should be used during match after the target has been
- // matched for this action (see the recipe override).
+ // matched for this action.
//
// Indicate whether there is a rule match with the first half of the
// result (see try_match()).
diff --git a/build2/target.ixx b/build2/target.ixx
index 88bc530..6d69545 100644
--- a/build2/target.ixx
+++ b/build2/target.ixx
@@ -67,6 +67,8 @@ namespace build2
{
assert (phase == run_phase::match);
+ // Note that the "tried" state is "final".
+ //
const opstate& s (state[a]);
size_t o (s.task_count.load (memory_order_relaxed) - // Synchronized.
target::count_base ());