From 907a284e955e22de8e78c838a873b0889b33a945 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 13 Aug 2016 17:11:30 +0200 Subject: Use extension derivation function rather than extension variable directly --- build2/cc/compile.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'build2/cc') diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index b5bcc50..92ddf3b 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -283,12 +283,17 @@ namespace build2 // We will just have to try all of the possible ones, in the "most // likely to match" order. // - const variable& var (var_pool["extension"]); - - auto test = [&s, &n, &e, &var] (const target_type& tt) -> bool + auto test = [&s, &n, &e] (const target_type& tt) -> bool { - if (auto l = s.find (var, tt, n)) - if (cast (l) == e) + // Call the extension derivation function. Here we know that it will + // only use the target type and name from the target key so we can + // pass bogus values for the rest. + // + const string* dummy (nullptr); + target_key tk {&tt, nullptr, nullptr, &n, dummy}; + + if (const string* de = tt.extension (tk, s)) + if (*de == e) return true; return false; -- cgit v1.1