aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-09-12 07:55:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-09-12 08:34:38 +0200
commit06c7e10f20cc1f2ade57914c9ec0c28afdc410aa (patch)
treec14c52d42c1b1beb4386ab6b4aaead9b6f163614 /libbuild2/target.cxx
parent05cba8680738c754d6ca46b8ead5030f633295b2 (diff)
Do not treat primary ad hoc group member as group for variable lookupadhoc-vars
Note that we started with this semantics but it was changed in a commit on 2021-09-16 for reasons not entirely unclear but most likely due to target- specific variables specified for the group not being set on all the members. Which we have now addressed (see the previous commit). Note also that this new (old) semantics is not without its own drawbacks. Specifically, there is a bit of waste when the target-specific variable is really only meant for the recipe and thus setting it on all the members is unnecessary. For example: <{hxx ixx cxx}{options}>: cli{options} { options = ... } {{ # Use options. }} But this feels like a quality of implementation rather than conceptual issue. For example, we could likely one day address it by synthesizing a separate group target for ad hoc groups.
Diffstat (limited to 'libbuild2/target.cxx')
-rw-r--r--libbuild2/target.cxx24
1 files changed, 5 insertions, 19 deletions
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx
index c78fc57..41a3273 100644
--- a/libbuild2/target.cxx
+++ b/libbuild2/target.cxx
@@ -158,21 +158,18 @@ namespace build2
{
++r.second;
-#if 1
+ // While we went back to not treating the first member as a group for
+ // variable lookup, let's keep this logic in case one day we end up with
+ // a separate ad hoc group target.
+ //
+#if 0
// In case of an ad hoc group, we may have to look in two groups.
//
if ((g1 = group) != nullptr)
{
auto p (g1->vars.lookup (var));
if (p.first != nullptr)
- {
- if (g1->adhoc_group ())
- fail << "ad hoc group variable lookup " << var <<
- info << "member " << *this <<
- info << "group " << *g1;
-
r.first = lookup_type (*p.first, p.second, g1->vars);
- }
else
{
if ((g2 = g1->group) != nullptr)
@@ -216,17 +213,6 @@ namespace build2
g1 != nullptr ? &g1k : nullptr,
g2 != nullptr ? &g2k : nullptr));
- if (p.first && g1 != nullptr && g1->adhoc_group ())
- {
- for (size_t d (2); d <= p.second; d += 3)
- {
- if (p.second == d)
- fail << "ad hoc group type/pattern variable lookup " << var <<
- info << "member " << *this <<
- info << "group " << *g1;
- }
- }
-
r.first = move (p.first);
r.second = r.first ? r.second + p.second : p.second;
}