aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-01-10 08:40:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-01-10 08:40:34 +0200
commit59dedd5cf8ab8d4b1cae3faed952982749e6f59a (patch)
tree2b5256e49c2cb268777456b4ac7946b0440fe9f7 /libbuild2
parentb236b111e52d08245d9bc1caadd6b78f7723f42c (diff)
Consider implied targets when resolving dynamic dependencies
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/dyndep.cxx19
-rw-r--r--libbuild2/target.hxx9
2 files changed, 21 insertions, 7 deletions
diff --git a/libbuild2/dyndep.cxx b/libbuild2/dyndep.cxx
index 92e8903..0865ccb 100644
--- a/libbuild2/dyndep.cxx
+++ b/libbuild2/dyndep.cxx
@@ -540,25 +540,30 @@ namespace build2
if (const target* x = t.ctx.targets.find (tt, d, out, n, e, trace))
{
- // What would be the harm in reusing an implied target if there is
- // no real one? Probably none (since it can't be updated) except
- // that it will be racy: sometimes we will reuse the implied,
- // sometimes we will insert a new one. And we don't like racy.
+ // What would be the harm in reusing a dynamically-inserted target
+ // if there is no buildfile-mentioned one? Probably none (since it
+ // can't be updated) except that it will be racy: sometimes we
+ // will reuse the dynamic, sometimes we will insert a new one. And
+ // we don't like racy.
//
- if (x->decl == target_decl::real)
+ // Note that we can't only check for real targets and must include
+ // implied ones because pre-entered members of a target group
+ // (e.g., cli.cxx) are implied.
+ //
+ if (x->decl >= target_decl::implied)
{
r = x;
break;
}
else
{
- // Cache the implied target corresponding to tts[0] since that's
+ // Cache the dynamic target corresponding to tts[0] since that's
// what we will be inserting (see below).
//
if (insert && i == 0)
f = x;
- l6 ([&]{trace << "implied target with target type " << tt.name;});
+ l6 ([&]{trace << "dynamic target with target type " << tt.name;});
}
}
else
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index 4ce871b..d584023 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -137,6 +137,15 @@ 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);
+ }
+
+ inline bool
+ operator>= (target_decl l, target_decl r) { return !(l < r); }
+
class LIBBUILD2_SYMEXPORT target
{
public: