From 921c2d503a63f4769fdf1c7e6eb31be2706f9bea Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 15 Oct 2020 14:20:44 +0200 Subject: Add ability to specify fallback value for NULL substitutions with in.null --- libbuild2/in/rule.hxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'libbuild2/in/rule.hxx') diff --git a/libbuild2/in/rule.hxx b/libbuild2/in/rule.hxx index cf67060..2fa1305 100644 --- a/libbuild2/in/rule.hxx +++ b/libbuild2/in/rule.hxx @@ -33,11 +33,13 @@ namespace build2 rule (string rule_id, string program, char symbol = '$', - bool strict = true) + bool strict = true, + optional null = nullopt) : rule_id_ (move (rule_id)), program_ (move (program)), symbol_ (symbol), - strict_ (strict) {} + strict_ (strict), + null_ (move (null)) {} virtual bool match (action, target&, const string&) const override; @@ -65,7 +67,8 @@ namespace build2 lookup (const location&, action, const target&, - const string& name) const; + const string& name, + const optional& null) const; // Perform variable substitution. Return nullopt if it should be // ignored. @@ -75,13 +78,15 @@ namespace build2 action, const target&, const string& name, - bool strict) const; + bool strict, + const optional& null) const; protected: const string rule_id_; const string program_; char symbol_; bool strict_; + optional null_; }; } } -- cgit v1.1