From 758a50eb1825f2e0c1acd5c61d36bb5b866585b8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 8 Jun 2020 09:18:11 +0200 Subject: Adjust rule_match name for ad hoc recipes --- libbuild2/rule.hxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libbuild2/rule.hxx') 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 (*this)) {} + rule_match (name, static_cast (*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 "" + // 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 ("", l, b) {} virtual bool recipe_text (context&, const target&, string&&, attributes&) override; -- cgit v1.1