aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-02-15 16:40:20 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-02-15 16:40:20 +0200
commitbc2efe549c842d08f8253083e97f38f154907750 (patch)
treeae174ced9b8d7d69343fa3d7048900e1267fafb0 /libbuild2
parent743273bd381a132c272226af00381da0494e8920 (diff)
Fix stray logic where libue{} was still considered member of libul{}
Fixes GitHub issue #179.
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/cc/link-rule.cxx37
1 files changed, 27 insertions, 10 deletions
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx
index 023b7e3..8d25aff 100644
--- a/libbuild2/cc/link-rule.cxx
+++ b/libbuild2/cc/link-rule.cxx
@@ -347,6 +347,11 @@ namespace build2
const target* pg (nullptr);
const target* pt (p.search_existing ());
+ auto search = [&t, &p] (const target_type& tt)
+ {
+ return search_existing (t.ctx, p.prerequisite.key (tt));
+ };
+
if (p.is_a<libul> ())
{
if (pt != nullptr)
@@ -369,23 +374,35 @@ namespace build2
{
// It's possible we have no group but have a member so try that.
//
- const target_type& tt (ot == otype::a ? libua::static_type :
- ot == otype::s ? libus::static_type :
- libue::static_type);
+ if (ot != otype::e)
+ {
+ const target_type& tt ();
- // We know this prerequisite member is a prerequisite since
- // otherwise the above search would have returned the member
- // target.
- //
- pt = search_existing (t.ctx, p.prerequisite.key (tt));
+ // We know this prerequisite member is a prerequisite since
+ // otherwise the above search would have returned the member
+ // target.
+ //
+ pt = search (ot == otype::a
+ ? libua::static_type
+ : libus::static_type);
+ }
+ else
+ {
+ // Similar semantics to bin::link_member(): prefer static over
+ // shared.
+ //
+ pt = search (libua::static_type);
+
+ if (pt == nullptr)
+ pt = search (libus::static_type);
+ }
}
}
else if (!p.is_a<libue> ())
{
// See if we also/instead have a group.
//
- pg = search_existing (t.ctx,
- p.prerequisite.key (libul::static_type));
+ pg = search (libul::static_type);
if (pt == nullptr)
swap (pt, pg);