aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-09-24 15:32:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-09-24 15:32:13 +0200
commit482d28f130511e7ce5f94dfcb03e020b4e1d9831 (patch)
tree0cdda07685ae5ce2f1b3ce1db98b3f4740db4181 /libbuild2
parentb6c61ea9afd2d738711770e44748e48be009154d (diff)
Fix target declaration upgrade logic
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/target.cxx12
-rw-r--r--libbuild2/target.hxx10
2 files changed, 10 insertions, 12 deletions
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx
index 8d76f56..df03128 100644
--- a/libbuild2/target.cxx
+++ b/libbuild2/target.cxx
@@ -484,12 +484,16 @@ namespace build2
// Fall through (continue as if the first find() returned this target).
}
- if (decl > t->decl)
+ // Without resorting to something like atomic we can only upgrade the
+ // declaration to real (which is expected to only happen during the load
+ // phase).
+ //
+ if (decl == target_decl::real)
{
- // The decl value can only be adjusted during the load phase.
- //
assert (ctx.phase == run_phase::load);
- t->decl = decl;
+
+ if (t->decl != target_decl::real)
+ t->decl = decl;
}
return pair<target&, ulock> (*t, ulock ());
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index ec97950..73363ae 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -118,12 +118,6 @@ namespace build2
real // Real dependency declaration.
};
- inline bool
- operator> (target_decl l, target_decl r)
- {
- return static_cast<uint8_t> (l) > static_cast<uint8_t> (r);
- }
-
class LIBBUILD2_SYMEXPORT target
{
public:
@@ -156,8 +150,8 @@ namespace build2
const dir_path&
out_dir () const {return out.empty () ? dir : out;}
- // Note that the declaration should only be upgraded during the load phase
- // via the MT-safe target_set::insert().
+ // Note that the target declaration should only be upgraded via the MT-
+ // safe target_set::insert().
//
target_decl decl;