aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/link-rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-16 11:30:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-16 11:30:41 +0200
commit63d1d6f8f4bb6db482b21e728245ebf9eee6b55f (patch)
tree61f1b519a447fd2b96c877bfced4b9fc8363824e /build2/cc/link-rule.cxx
parentef12b3bf80e2eec3fcfd36cceee02f357a992039 (diff)
Fix group link-up race
Diffstat (limited to 'build2/cc/link-rule.cxx')
-rw-r--r--build2/cc/link-rule.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index c59597a..bdf75c7 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -54,15 +54,10 @@ namespace build2
// If this is a library, link-up to our group (this is the target group
// protocol which means this can be done whether we match or not).
//
- if (lt.library ())
- {
- //@@ inner/outer race (see install-rule)?
-
- if (t.group == nullptr)
- t.group = &search (t,
- lt.utility ? libu::static_type : lib::static_type,
- t.dir, t.out, t.name);
- }
+ if (lt.library () && t.group == nullptr)
+ t.group = &search (t,
+ lt.utility ? libu::static_type : lib::static_type,
+ t.dir, t.out, t.name);
// Scan prerequisites and see if we can work with what we've got. Note
// that X could be C. We handle this by always checking for X first.
@@ -777,6 +772,8 @@ namespace build2
? (group ? bmi::static_type : tt.bmi)
: (group ? obj::static_type : tt.obj));
+ resolve_group (a, *pt); // Not matched yet so resolve group.
+
bool src (false);
for (prerequisite_member p1: group_prerequisite_members (a, *pt))
{
@@ -904,6 +901,8 @@ namespace build2
//
bool mod (x_mod != nullptr && p.is_a (*x_mod));
+ // Note: group already resolved in the previous loop.
+
for (prerequisite_member p1: group_prerequisite_members (a, *pt))
{
if (p1.is_a (mod ? *x_mod : x_src) || p1.is_a<c> ())