diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-02 10:20:50 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:41 +0200 |
commit | 53f02bf28dae507a51515ed6ac03226d68816494 (patch) | |
tree | 234838165e802df9c777324c0fe766ce0190d814 /build2/cli | |
parent | 601ffbd700e7c11a101215d641ea09d0181d4771 (diff) |
Store extension in target map key rather than in target
This is in preparation for locking its modification/access.
Diffstat (limited to 'build2/cli')
-rw-r--r-- | build2/cli/rule.cxx | 11 | ||||
-rw-r--r-- | build2/cli/target | 4 | ||||
-rw-r--r-- | build2/cli/target.cxx | 4 |
3 files changed, 11 insertions, 8 deletions
diff --git a/build2/cli/rule.cxx b/build2/cli/rule.cxx index 773d00c..262e89a 100644 --- a/build2/cli/rule.cxx +++ b/build2/cli/rule.cxx @@ -211,17 +211,20 @@ namespace build2 const char* option, const char* default_extension) { - assert (t.ext); // Should have been figured out in apply(). + // Should have been figured out in apply(). + // + const optional<string>& e (*t.ext_); + assert (e); - if (*t.ext != default_extension) + if (*e != default_extension) { // CLI needs the extension with the leading dot (unless it is empty) // while we store the extension without. But if there is an extension, // then we can get it (with the dot) from the file name. // args.push_back (option); - args.push_back (t.ext->empty () - ? t.ext->c_str () + args.push_back (e->empty () + ? e->c_str () : t.path ().extension_cstring () - 1); } } diff --git a/build2/cli/target b/build2/cli/target index 0cc448d..f4ab7e7 100644 --- a/build2/cli/target +++ b/build2/cli/target @@ -49,8 +49,8 @@ namespace build2 //using mtime_target::mtime_target; // @@ GCC 4.8 - cli_cxx (dir_path d, dir_path o, string n, optional<string> e) - : mtime_target (move (d), move (o), move (n), move (e)) + cli_cxx (dir_path d, dir_path o, string n) + : mtime_target (move (d), move (o), move (n)) { m[0] = m[1] = m[2] = nullptr; } diff --git a/build2/cli/target.cxx b/build2/cli/target.cxx index 3f09d30..48dc95b 100644 --- a/build2/cli/target.cxx +++ b/build2/cli/target.cxx @@ -48,7 +48,7 @@ namespace build2 return file_mtime (h->path ()); } - static target* + static pair<target*, optional<string>> cli_cxx_factory (const target_type&, dir_path d, dir_path o, @@ -66,7 +66,7 @@ namespace build2 targets.insert<cxx::cxx> (d, o, n, trace); targets.insert<cxx::ixx> (d, o, n, trace); - return new cli_cxx (move (d), move (o), move (n), move (e)); + return make_pair (new cli_cxx (move (d), move (o), move (n)), move (e)); } const target_type cli_cxx::static_type |