aboutsummaryrefslogtreecommitdiff
path: root/build2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-13 17:11:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-13 17:11:30 +0200
commit907a284e955e22de8e78c838a873b0889b33a945 (patch)
treeaacdd9369acbd0693301568d42f66445314d28ec /build2/cc
parent53eb43126e562a43f4e8f2247af10da5c4c3c87f (diff)
Use extension derivation function rather than extension variable directly
Diffstat (limited to 'build2/cc')
-rw-r--r--build2/cc/compile.cxx15
1 files changed, 10 insertions, 5 deletions
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<string> (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;