From a5949f9e974171144dba84771a9f305f9e1dcc3f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 27 Jan 2016 13:59:51 +0200 Subject: Rework default extension derivation, again --- build2/target.txx | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'build2/target.txx') diff --git a/build2/target.txx b/build2/target.txx index fbaa8ef..4999f61 100644 --- a/build2/target.txx +++ b/build2/target.txx @@ -10,14 +10,14 @@ namespace build2 { template - const string& + const string* target_extension_fix (const target_key&, scope&) { - return extension_pool.find (ext); + return &extension_pool.find (ext); } template - const string& + const string* target_extension_var (const target_key& tk, scope& s) { // Include target type/pattern-specific variables. @@ -27,29 +27,10 @@ namespace build2 // Help the user here and strip leading '.' from the extension. // const string& e (as (*l)); - return extension_pool.find ( + return &extension_pool.find ( !e.empty () && e.front () == '.' ? string (e, 1) : e); } - if (def != nullptr) - return extension_pool.find (def); - - // Similar code to target_extension_fail(). - // - { - diag_record dr; - dr << error << "no default extension in variable '" << var << "'" - << info << "required to derive file name for "; - - if (tk.dir->absolute ()) - dr << "target " << tk; - else - dr << "prerequisite " << prerequisite_key {nullptr, tk, &s}; - - dr << info << "perhaps you forgot to add " - << tk.type->name << "{*}: " << var << " = ..."; - } - - throw failed (); + return def != nullptr ? &extension_pool.find (def) : nullptr; } } -- cgit v1.1