aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-06-08 09:18:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-08 09:18:11 +0200
commit758a50eb1825f2e0c1acd5c61d36bb5b866585b8 (patch)
treed763465e25a4ee3c1eb921e444bf4909e71f4185 /libbuild2
parente0ae9b1bebe4cab2e5d8e8e7a61b93632bd083cd (diff)
Adjust rule_match name for ad hoc recipes
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/rule.cxx5
-rw-r--r--libbuild2/rule.hxx12
-rw-r--r--libbuild2/target.hxx2
3 files changed, 14 insertions, 5 deletions
diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx
index f257b62..0df6517 100644
--- a/libbuild2/rule.cxx
+++ b/libbuild2/rule.cxx
@@ -894,7 +894,10 @@ namespace build2
//
adhoc_cxx_rule::
adhoc_cxx_rule (const location& l, size_t b, uint64_t v, optional<string> s)
- : adhoc_rule (l, b), version (v), separator (move (s)), impl (nullptr)
+ : adhoc_rule ("<ad hoc c++ recipe>", l, b),
+ version (v),
+ separator (move (s)),
+ impl (nullptr)
{
if (v != 1)
fail (l) << "unsupported c++ recipe version " << v;
diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx
index aa2f003..f3581c8 100644
--- a/libbuild2/rule.hxx
+++ b/libbuild2/rule.hxx
@@ -124,10 +124,10 @@ namespace build2
location_value loc; // Buildfile location of the recipe.
size_t braces; // Number of braces in multi-brace tokens.
- adhoc_rule (const location& l, size_t b)
+ adhoc_rule (const char* name, const location& l, size_t b)
: loc (l),
braces (b),
- rule_match ("adhoc", static_cast<const rule&> (*this)) {}
+ rule_match (name, static_cast<const rule&> (*this)) {}
// Set the rule text, handle any recipe-specific attributes, and return
// true if the recipe builds anything in the build/recipes/ directory and
@@ -164,6 +164,11 @@ namespace build2
// Implementation details.
//
public:
+ // The name in rule_match is used as a hint and as a name in diagnostics.
+ // The former does not apply to us (but will apply to ad hoc rules) while
+ // latter does. As a result, we use special-looking "<ad hoc X recipe>"
+ // names.
+ //
build2::rule_match rule_match;
static const dir_path recipes_build_dir;
@@ -193,7 +198,8 @@ namespace build2
target_state
default_action (action, const target&) const;
- adhoc_script_rule (const location& l, size_t b): adhoc_rule (l, b) {}
+ adhoc_script_rule (const location& l, size_t b)
+ : adhoc_rule ("<ad hoc buildscript recipe>", l, b) {}
virtual bool
recipe_text (context&, const target&, string&&, attributes&) override;
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index 667ef79..26bb135 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -195,7 +195,7 @@ namespace build2
// would be much easier and more consistent to make these extra files
// proper targets.
//
- // So to support this requirement we have "ad hoc" groups. The idea is
+ // So to support this requirement we have ad hoc groups. The idea is
// that any target can be turned either by a user's declaration in a
// buildfile or by the rule that matches it into an ad hoc group by
// chaining several targets together.