aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/rule.hxx
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/rule.hxx
parente0ae9b1bebe4cab2e5d8e8e7a61b93632bd083cd (diff)
Adjust rule_match name for ad hoc recipes
Diffstat (limited to 'libbuild2/rule.hxx')
-rw-r--r--libbuild2/rule.hxx12
1 files changed, 9 insertions, 3 deletions
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;