diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-22 14:38:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-23 18:14:07 +0200 |
commit | 5035f4ef68922ac758b1e4734e67d73c9228010b (patch) | |
tree | 271fdd5b1d6e995a058d97aacb3ac90a538d9ff1 /build2/cc | |
parent | 8793941652d6aa1c3d02b2f87f691e6d06254b7d (diff) |
Introduce notion of build context
All non-const global state is now in class context and we can now have
multiple independent builds going on at the same time.
Diffstat (limited to 'build2/cc')
-rw-r--r-- | build2/cc/common.cxx | 43 | ||||
-rw-r--r-- | build2/cc/common.hxx | 4 | ||||
-rw-r--r-- | build2/cc/compile-rule.cxx | 82 | ||||
-rw-r--r-- | build2/cc/init.cxx | 13 | ||||
-rw-r--r-- | build2/cc/link-rule.cxx | 40 | ||||
-rw-r--r-- | build2/cc/module.cxx | 16 | ||||
-rw-r--r-- | build2/cc/msvc.cxx | 9 | ||||
-rw-r--r-- | build2/cc/pkgconfig.cxx | 19 | ||||
-rw-r--r-- | build2/cc/target.cxx | 8 | ||||
-rw-r--r-- | build2/cc/utility.cxx | 4 | ||||
-rw-r--r-- | build2/cc/windows-manifest.cxx | 2 | ||||
-rw-r--r-- | build2/cc/windows-rpath.cxx | 4 |
12 files changed, 141 insertions, 103 deletions
diff --git a/build2/cc/common.cxx b/build2/cc/common.cxx index aa0eb89..4f5db4c 100644 --- a/build2/cc/common.cxx +++ b/build2/cc/common.cxx @@ -87,7 +87,7 @@ namespace build2 bool impl (proc_impl && proc_impl (l, la)); bool cc (false), same (false); - auto& vp (var_pool); + auto& vp (top_bs.ctx.var_pool); lookup c_e_libs; lookup x_e_libs; @@ -221,7 +221,7 @@ namespace build2 : &cast<dir_paths> ( bs.root_scope ()->vars[same ? x_sys_lib_dirs - : var_pool[*t + ".sys_lib_dirs"]]); + : bs.ctx.var_pool[*t + ".sys_lib_dirs"]]); }; auto find_linfo = [top_li, t, cc, &bs, &l, &li] () @@ -474,7 +474,7 @@ namespace build2 if (xt == nullptr) { if (n.qualified ()) - xt = import_existing (pk); + xt = import_existing (s.ctx, pk); } if (xt == nullptr) @@ -494,20 +494,21 @@ namespace build2 // template <typename T> ulock common:: - insert_library (T*& r, + insert_library (context& ctx, + T*& r, const string& name, const dir_path& d, optional<string> ext, bool exist, tracer& trace) { - auto p (targets.insert_locked (T::static_type, - d, - dir_path (), - name, - move (ext), - true, // Implied. - trace)); + auto p (ctx.targets.insert_locked (T::static_type, + d, + dir_path (), + name, + move (ext), + true, // Implied. + trace)); assert (!exist || !p.second.owns_lock ()); r = &p.first.template as<T> (); @@ -626,6 +627,8 @@ namespace build2 &name, ext, &p, &f, exist, &trace, this] (const dir_path& d) -> bool { + context& ctx (p.scope->ctx); + timestamp mt; // libs @@ -648,9 +651,10 @@ namespace build2 if (tclass == "windows") { libi* i (nullptr); - insert_library (i, name, d, se, exist, trace); + insert_library (ctx, i, name, d, se, exist, trace); - ulock l (insert_library (s, name, d, nullopt, exist, trace)); + ulock l ( + insert_library (ctx, s, name, d, nullopt, exist, trace)); if (!exist) { @@ -677,7 +681,7 @@ namespace build2 } else { - insert_library (s, name, d, se, exist, trace); + insert_library (ctx, s, name, d, se, exist, trace); s->mtime (mt); s->path (move (f)); @@ -697,7 +701,7 @@ namespace build2 if (mt != timestamp_nonexistent) { - insert_library (s, name, d, se, exist, trace); + insert_library (ctx, s, name, d, se, exist, trace); s->mtime (mt); s->path (move (f)); @@ -722,7 +726,7 @@ namespace build2 // Note that this target is outside any project which we treat // as out trees. // - insert_library (a, name, d, ae, exist, trace); + insert_library (ctx, a, name, d, ae, exist, trace); a->mtime (mt); a->path (move (f)); } @@ -760,14 +764,14 @@ namespace build2 if (na && !r.first.empty ()) { - insert_library (a, name, d, nullopt, exist, trace); + insert_library (ctx, a, name, d, nullopt, exist, trace); a->mtime (timestamp_unreal); a->path (empty_path); } if (ns && !r.second.empty ()) { - insert_library (s, name, d, nullopt, exist, trace); + insert_library (ctx, s, name, d, nullopt, exist, trace); s->mtime (timestamp_unreal); s->path (empty_path); } @@ -821,7 +825,8 @@ namespace build2 // Enter (or find) the lib{} target group. // lib* lt; - insert_library (lt, name, *pd, l ? p.tk.ext : nullopt, exist, trace); + insert_library ( + p.scope->ctx, lt, name, *pd, l ? p.tk.ext : nullopt, exist, trace); // Result. // diff --git a/build2/cc/common.hxx b/build2/cc/common.hxx index c58a7f3..b24eb7d 100644 --- a/build2/cc/common.hxx +++ b/build2/cc/common.hxx @@ -8,6 +8,7 @@ #include <libbuild2/types.hxx> #include <libbuild2/utility.hxx> +#include <libbuild2/context.hxx> #include <libbuild2/variable.hxx> #include <build2/bin/target.hxx> @@ -278,7 +279,8 @@ namespace build2 template <typename T> static ulock - insert_library (T*&, + insert_library (context&, + T*&, const string&, const dir_path&, optional<string>, diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx index 833fd44..fa43533 100644 --- a/build2/cc/compile-rule.cxx +++ b/build2/cc/compile-rule.cxx @@ -365,7 +365,9 @@ namespace build2 const variable& var ( com ? c_export_poptions - : (t == x ? x_export_poptions : var_pool[t + ".export.poptions"])); + : (t == x + ? x_export_poptions + : l.ctx.var_pool[t + ".export.poptions"])); append_options (args, l, var); }; @@ -418,7 +420,9 @@ namespace build2 const variable& var ( com ? c_export_poptions - : (t == x ? x_export_poptions : var_pool[t + ".export.poptions"])); + : (t == x + ? x_export_poptions + : l.ctx.var_pool[t + ".export.poptions"])); hash_options (cs, l, var); }; @@ -472,7 +476,9 @@ namespace build2 const variable& var ( com ? c_export_poptions - : (t == x ? x_export_poptions : var_pool[t + ".export.poptions"])); + : (t == x + ? x_export_poptions + : l.ctx.var_pool[t + ".export.poptions"])); append_prefixes (m, l, var); }; @@ -553,7 +559,7 @@ namespace build2 // @@ MT perf: so we are going to switch the phase and execute for // any generated header. // - phase_switch ps (run_phase::execute); + phase_switch ps (t.ctx, run_phase::execute); target_state ns (execute_direct (a, t)); if (ns != os && ns != target_state::unchanged) @@ -577,6 +583,8 @@ namespace build2 match_data& md (t.data<match_data> ()); + context& ctx (t.ctx); + // Note: until refined below, non-BMI-generating translation unit is // assumed non-modular. // @@ -692,7 +700,7 @@ namespace build2 // Start asynchronous matching of prerequisites. Wait with unlocked // phase to allow phase switching. // - wait_guard wg (target::count_busy (), t[a].task_count, true); + wait_guard wg (ctx, ctx.count_busy (), t[a].task_count, true); size_t start (pts.size ()); // Index of the first to be added. for (prerequisite_member p: group_prerequisite_members (a, t)) @@ -754,7 +762,7 @@ namespace build2 continue; } - match_async (a, *pt, target::count_busy (), t[a].task_count); + match_async (a, *pt, ctx.count_busy (), t[a].task_count); pts.push_back (prerequisite_target (pt, pi)); } @@ -1142,7 +1150,7 @@ namespace build2 // to keep re-validating the file on every subsequent dry-run as well // on the real run). // - if (u && dd.reading () && !dry_run) + if (u && dd.reading () && !ctx.dry_run) dd.touch = true; dd.close (); @@ -2161,7 +2169,7 @@ namespace build2 // small_vector<const target_type*, 2> tts; - const scope& bs (scopes.find (d)); + const scope& bs (t.ctx.scopes.find (d)); if (const scope* rs = bs.root_scope ()) { tts = map_extension (bs, n, e); @@ -2201,7 +2209,7 @@ namespace build2 // absolute path with a spelled-out extension to multiple targets. // for (const target_type* tt: tts) - if ((r = targets.find (*tt, d, out, n, e, trace)) != nullptr) + if ((r = t.ctx.targets.find (*tt, d, out, n, e, trace)) != nullptr) break; // Note: we can't do this because of the in-source builds where @@ -2887,7 +2895,7 @@ namespace build2 // See if this path is inside a project with an out-of- // tree build and is in the out directory tree. // - const scope& bs (scopes.find (d)); + const scope& bs (t.ctx.scopes.find (d)); if (bs.root_scope () != nullptr) { const dir_path& bp (bs.out_path ()); @@ -5101,18 +5109,18 @@ namespace build2 modules_sidebuild_dir /= x); - const scope* ps (&scopes.find (pd)); + const scope* ps (&rs.ctx.scopes.find (pd)); if (ps->out_path () != pd) { // Switch the phase to load then create and load the subproject. // - phase_switch phs (run_phase::load); + phase_switch phs (rs.ctx, run_phase::load); // Re-test again now that we are in exclusive phase (another thread // could have already created and loaded the subproject). // - ps = &scopes.find (pd); + ps = &rs.ctx.scopes.find (pd); if (ps->out_path () != pd) { @@ -5200,7 +5208,7 @@ namespace build2 // exists then we assume all this is already done (otherwise why would // someone have created such a target). // - if (const file* bt = targets.find<file> ( + if (const file* bt = bs.ctx.targets.find<file> ( tt, pd, dir_path (), // Always in the out tree. @@ -5237,13 +5245,14 @@ namespace build2 } } - auto p (targets.insert_locked (tt, - move (pd), - dir_path (), // Always in the out tree. - move (mf), - nullopt, // Use default extension. - true, // Implied. - trace)); + auto p (bs.ctx.targets.insert_locked ( + tt, + move (pd), + dir_path (), // Always in the out tree. + move (mf), + nullopt, // Use default extension. + true, // Implied. + trace)); file& bt (static_cast<file&> (p.first)); // Note that this is racy and someone might have created this target @@ -5295,7 +5304,7 @@ namespace build2 const target_type& tt (compile_types (li.type).hbmi); - if (const file* bt = targets.find<file> ( + if (const file* bt = bs.ctx.targets.find<file> ( tt, pd, dir_path (), // Always in the out tree. @@ -5307,13 +5316,14 @@ namespace build2 prerequisites ps; ps.push_back (prerequisite (ht)); - auto p (targets.insert_locked (tt, - move (pd), - dir_path (), // Always in the out tree. - move (mf), - nullopt, // Use default extension. - true, // Implied. - trace)); + auto p (bs.ctx.targets.insert_locked ( + tt, + move (pd), + dir_path (), // Always in the out tree. + move (mf), + nullopt, // Use default extension. + true, // Implied. + trace)); file& bt (static_cast<file&> (p.first)); // Note that this is racy and someone might have created this target @@ -5550,6 +5560,8 @@ namespace build2 match_data md (move (t.data<match_data> ())); unit_type ut (md.type); + context& ctx (t.ctx); + // While all our prerequisites are already up-to-date, we still have to // execute them to keep the dependency counts straight. Actually, no, we // may also have to update the modules. @@ -5575,9 +5587,9 @@ namespace build2 { if (md.touch) { - touch (tp, false, 2); + touch (ctx, tp, false, 2); t.mtime (system_clock::now ()); - skip_count.fetch_add (1, memory_order_relaxed); + ctx.skip_count.fetch_add (1, memory_order_relaxed); } // Note: else mtime should be cached. @@ -5592,7 +5604,7 @@ namespace build2 ? system_clock::now () : timestamp_unknown); - touch (md.dd, false, verb_never); + touch (ctx, md.dd, false, verb_never); const scope& bs (t.base_scope ()); const scope& rs (*bs.root_scope ()); @@ -5941,7 +5953,7 @@ namespace build2 // translation unit (i.e., one of the imported module's has BMIs // changed). // - if (!dry_run) + if (!ctx.dry_run) { try { @@ -6020,7 +6032,7 @@ namespace build2 if (verb >= 2) print_process (args); - if (!dry_run) + if (!ctx.dry_run) { // Remove the target file if this fails. If we don't do that, we // will end up with a broken build that is up-to-date. @@ -6053,7 +6065,7 @@ namespace build2 timestamp now (system_clock::now ()); - if (!dry_run) + if (!ctx.dry_run) depdb::check_mtime (start, md.dd, tp, now); // Should we go to the filesystem and get the new mtime? We know the diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx index e22ece7..c83d5ed 100644 --- a/build2/cc/init.cxx +++ b/build2/cc/init.cxx @@ -26,27 +26,29 @@ namespace build2 static target_state clean_module_sidebuilds (action, const scope& rs, const dir&) { + context& ctx (rs.ctx); + const dir_path& out_root (rs.out_path ()); dir_path d (out_root / rs.root_extra->build_dir / modules_sidebuild_dir); if (exists (d)) { - if (build2::rmdir_r (d)) + if (rmdir_r (ctx, d)) { // Clean up cc/ if it became empty. // d = out_root / rs.root_extra->build_dir / module_dir; if (empty (d)) { - rmdir (d); + rmdir (ctx, d); // And build/ if it also became empty (e.g., in case of a build // with a transient configuration). // d = out_root / rs.root_extra->build_dir; if (empty (d)) - rmdir (d); + rmdir (ctx, d); } return target_state::changed; @@ -77,7 +79,7 @@ namespace build2 // Enter variables. Note: some overridable, some not. // - auto& v (var_pool.rw (rs)); + auto& v (rs.ctx.var_pool.rw (rs)); auto v_t (variable_visibility::target); @@ -276,7 +278,8 @@ namespace build2 // Prepare configuration hints. They are only used on the first load // of bin.config so we only populate them on our first load. // - variable_map h; + variable_map h (rs.ctx); + if (first) { // Note that all these variables have already been registered. diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index bb91722..bfc31d7 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -165,14 +165,15 @@ namespace build2 // otherwise the above search would have returned the member // target. // - pt = search_existing (p.prerequisite.key (tt)); + pt = search_existing (t.ctx, p.prerequisite.key (tt)); } } else if (!p.is_a<libue> ()) { // See if we also/instead have a group. // - pg = search_existing (p.prerequisite.key (libul::static_type)); + pg = search_existing (t.ctx, + p.prerequisite.key (libul::static_type)); if (pt == nullptr) swap (pt, pg); @@ -483,6 +484,7 @@ namespace build2 tracer trace (x, "link_rule::apply"); file& t (xt.as<file> ()); + context& ctx (t.ctx); // Note that for_install is signalled by install_rule and therefore // can only be relied upon during execute. @@ -697,7 +699,7 @@ namespace build2 // Note that ad hoc inputs have to be explicitly marked with the // include=adhoc prerequisite-specific variable. // - if (current_outer_oif != nullptr) + if (ctx.current_outer_oif != nullptr) continue; } @@ -945,7 +947,7 @@ namespace build2 // Windows. // #ifdef _WIN32 - dir.state[a].assign (var_backlink) = "copy"; + dir.state[a].assign (ctx.var_backlink) = "copy"; #endif } } @@ -1163,7 +1165,7 @@ namespace build2 bool u; if ((u = pt->is_a<libux> ()) || pt->is_a<liba> ()) { - const variable& var (var_pool["bin.whole"]); // @@ Cache. + const variable& var (ctx.var_pool["bin.whole"]); // @@ Cache. // See the bin module for the lookup semantics discussion. Note // that the variable is not overridable so we omit find_override() @@ -1197,7 +1199,7 @@ namespace build2 // Wait with unlocked phase to allow phase switching. // - wait_guard wg (target::count_busy (), t[a].task_count, true); + wait_guard wg (ctx, ctx.count_busy (), t[a].task_count, true); i = start; for (prerequisite_member p: group_prerequisite_members (a, t)) @@ -1229,7 +1231,7 @@ namespace build2 } } - match_async (a, *pt, target::count_busy (), t[a].task_count); + match_async (a, *pt, ctx.count_busy (), t[a].task_count); mark (pt, m); } @@ -1473,7 +1475,7 @@ namespace build2 ? (exp ? c_export_loptions : c_loptions) : (t == x ? (exp ? x_export_loptions : x_loptions) - : var_pool[t + (exp ? ".export.loptions" : ".loptions")])); + : l.ctx.var_pool[t + (exp ? ".export.loptions" : ".loptions")])); append_options (d.args, *g, var); } @@ -1575,7 +1577,7 @@ namespace build2 ? (exp ? c_export_loptions : c_loptions) : (t == x ? (exp ? x_export_loptions : x_loptions) - : var_pool[t + (exp ? ".export.loptions" : ".loptions")])); + : l.ctx.var_pool[t + (exp ? ".export.loptions" : ".loptions")])); hash_options (d.cs, *g, var); } @@ -1747,6 +1749,8 @@ namespace build2 const file& t (xt.as<file> ()); const path& tp (t.path ()); + context& ctx (t.ctx); + const scope& bs (t.base_scope ()); const scope& rs (*bs.root_scope ()); @@ -1866,7 +1870,7 @@ namespace build2 if (verb >= 3) print_process (args); - if (!dry_run) + if (!ctx.dry_run) { auto_rmfile rm (of); @@ -1966,7 +1970,7 @@ namespace build2 const string& cs ( cast<string> ( rs[tsys == "win32-msvc" - ? var_pool["bin.ld.checksum"] + ? ctx.var_pool["bin.ld.checksum"] : x_checksum])); if (dd.expect (cs) != nullptr) @@ -2726,7 +2730,7 @@ namespace build2 // auto_rmfile rm; - if (!dry_run) + if (!ctx.dry_run) { rm = auto_rmfile (relt); @@ -2823,7 +2827,7 @@ namespace build2 if (verb >= 2) print_process (args); - if (!dry_run) + if (!ctx.dry_run) run (rl, args); } @@ -2843,12 +2847,12 @@ namespace build2 // For shared libraries we may need to create a bunch of symlinks (or // fallback to hardlinks/copies on Windows). // - auto ln = [] (const path& f, const path& l) + auto ln = [&ctx] (const path& f, const path& l) { if (verb >= 3) text << "ln -sf " << f << ' ' << l; - if (dry_run) + if (ctx.dry_run) return; try @@ -2908,12 +2912,12 @@ namespace build2 // if (tsys == "darwin" && cast<string> (rs["bin.ar.id"]) == "generic") { - if (!dry_run) - touch (tp, false /* create */, verb_never); + if (!ctx.dry_run) + touch (ctx, tp, false /* create */, verb_never); } } - if (!dry_run) + if (!ctx.dry_run) { rm.cancel (); dd.check_mtime (tp); diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx index 36cdd1a..064d954 100644 --- a/build2/cc/module.cxx +++ b/build2/cc/module.cxx @@ -41,9 +41,13 @@ namespace build2 config::save_module (rs, x, 250); - const variable& config_c_poptions (var_pool["config.cc.poptions"]); - const variable& config_c_coptions (var_pool["config.cc.coptions"]); - const variable& config_c_loptions (var_pool["config.cc.loptions"]); + auto& vp (rs.ctx.var_pool.rw (rs)); + + // Must already exist. + // + const variable& config_c_poptions (vp["config.cc.poptions"]); + const variable& config_c_coptions (vp["config.cc.coptions"]); + const variable& config_c_loptions (vp["config.cc.loptions"]); // config.x // @@ -63,8 +67,6 @@ namespace build2 // if (!cc_loaded) { - auto& vp (var_pool.rw (rs)); - for (const char* const* pm (x_hinters); *pm != nullptr; ++pm) { string m (*pm); @@ -201,7 +203,7 @@ namespace build2 { // Prepare configuration hints. // - variable_map h; + variable_map h (rs.ctx); // Note that all these variables have already been registered. // @@ -545,7 +547,7 @@ namespace build2 // if (!cast_false<bool> (rs["cc.core.config.loaded"])) { - variable_map h; + variable_map h (rs.ctx); if (!ci.bin_pattern.empty ()) h.assign ("config.bin.pattern") = ci.bin_pattern; diff --git a/build2/cc/msvc.cxx b/build2/cc/msvc.cxx index 6125fdd..7d8c3f5 100644 --- a/build2/cc/msvc.cxx +++ b/build2/cc/msvc.cxx @@ -365,6 +365,7 @@ namespace build2 { // Pretty similar logic to search_library(). // + assert (p.scope != nullptr); const optional<string>& ext (p.tk.ext); const string& name (*p.tk.name); @@ -403,7 +404,7 @@ namespace build2 // Enter the target. // T* t; - common::insert_library (t, name, d, e, exist, trace); + common::insert_library (p.scope->ctx, t, name, d, e, exist, trace); t->mtime (mt); t->path (move (f)); @@ -453,6 +454,8 @@ namespace build2 { tracer trace (x, "msvc_search_shared"); + assert (pk.scope != nullptr); + libs* s (nullptr); auto search = [&s, &ld, &d, &pk, exist, &trace] ( @@ -461,7 +464,9 @@ namespace build2 if (libi* i = msvc_search_library<libi> ( ld, d, pk, otype::s, pf, sf, exist, trace)) { - ulock l (insert_library (s, *pk.tk.name, d, nullopt, exist, trace)); + ulock l ( + insert_library ( + pk.scope->ctx, s, *pk.tk.name, d, nullopt, exist, trace)); if (!exist) { diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx index c23b746..3b4c711 100644 --- a/build2/cc/pkgconfig.cxx +++ b/build2/cc/pkgconfig.cxx @@ -1027,7 +1027,7 @@ namespace build2 // Parse modules and add them to the prerequisites. // - auto parse_modules = [&trace, &next, this] + auto parse_modules = [&trace, &next, &s, this] (const pkgconf& pc, prerequisites& ps) { string mstr (pc.variable ("cxx_modules")); @@ -1057,7 +1057,7 @@ namespace build2 // For now there are only C++ modules. // auto tl ( - targets.insert_locked ( + s.ctx.targets.insert_locked ( *x_mod, mp.directory (), dir_path (), @@ -1228,6 +1228,8 @@ namespace build2 { tracer trace (x, "pkgconfig_save"); + context& ctx (l.ctx); + const scope& bs (l.base_scope ()); const scope& rs (*bs.root_scope ()); @@ -1246,7 +1248,7 @@ namespace build2 if (verb >= 2) text << "cat >" << p; - if (dry_run) + if (ctx.dry_run) return; auto_rmfile arm (p); @@ -1256,9 +1258,12 @@ namespace build2 ofdstream os (p); { - const project_name& n (cast<project_name> (rs.vars[var_project])); + const project_name& n (project (rs)); + + if (n.empty ()) + fail << "no project name in " << rs; - lookup vl (rs.vars[var_version]); + lookup vl (rs.vars[ctx.var_version]); if (!vl) fail << "no version variable in project " << n << info << "while generating " << p; @@ -1271,12 +1276,12 @@ namespace build2 // This one is required so make something up if unspecified. // os << "Description: "; - if (const string* s = cast_null<string> (rs[var_project_summary])) + if (const string* s = cast_null<string> (rs[ctx.var_project_summary])) os << *s << endl; else os << n << ' ' << v << endl; - if (const string* u = cast_null<string> (rs[var_project_url])) + if (const string* u = cast_null<string> (rs[ctx.var_project_url])) os << "URL: " << *u << endl; } diff --git a/build2/cc/target.cxx b/build2/cc/target.cxx index c637e60..89b9391 100644 --- a/build2/cc/target.cxx +++ b/build2/cc/target.cxx @@ -33,8 +33,8 @@ namespace build2 &cc::static_type, &target_factory<h>, nullptr, /* fixed_extension */ - &target_extension_var<var_extension, h_ext_def>, - &target_pattern_var<var_extension, h_ext_def>, + &target_extension_var<h_ext_def>, + &target_pattern_var<h_ext_def>, nullptr, &file_search, false @@ -48,8 +48,8 @@ namespace build2 &cc::static_type, &target_factory<c>, nullptr, /* fixed_extension */ - &target_extension_var<var_extension, c_ext_def>, - &target_pattern_var<var_extension, c_ext_def>, + &target_extension_var<c_ext_def>, + &target_pattern_var<c_ext_def>, nullptr, &file_search, false diff --git a/build2/cc/utility.cxx b/build2/cc/utility.cxx index 3271f7c..e9d4ce3 100644 --- a/build2/cc/utility.cxx +++ b/build2/cc/utility.cxx @@ -70,9 +70,9 @@ namespace build2 // Called by the compile rule during execute. // - return phase == run_phase::match && !exist + return x.ctx.phase == run_phase::match && !exist ? &search (x, tt, x.dir, x.out, x.name) - : search_existing (tt, x.dir, x.out, x.name); + : search_existing (x.ctx, tt, x.dir, x.out, x.name); } else { diff --git a/build2/cc/windows-manifest.cxx b/build2/cc/windows-manifest.cxx index da12f0f..733cae5 100644 --- a/build2/cc/windows-manifest.cxx +++ b/build2/cc/windows-manifest.cxx @@ -119,7 +119,7 @@ namespace build2 if (verb >= 3) text << "cat >" << mf; - if (!dry_run) + if (!t.ctx.dry_run) { auto_rmfile rm (mf); diff --git a/build2/cc/windows-rpath.cxx b/build2/cc/windows-rpath.cxx index d81e3b0..4478f7d 100644 --- a/build2/cc/windows-rpath.cxx +++ b/build2/cc/windows-rpath.cxx @@ -281,7 +281,7 @@ namespace build2 // simpler. // { - rmdir_status s (build2::rmdir_r (ad, empty, 3)); + rmdir_status s (rmdir_r (t.ctx, ad, empty, 3)); if (empty) return; @@ -362,7 +362,7 @@ namespace build2 if (verb >= 3) text << "cat >" << am; - if (dry_run) + if (t.ctx.dry_run) return; auto_rmfile rm (am); |