From ccb417a7c1456427b76914e8a11ca87b4926eeb3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 28 Jan 2020 08:41:57 +0200 Subject: Use scope::var_pool() --- libbuild2/bin/init.cxx | 24 +++---- libbuild2/c/init.cxx | 134 +++++++++++++++++++-------------------- libbuild2/cc/init.cxx | 54 ++++++++-------- libbuild2/cc/module.cxx | 2 +- libbuild2/config/init.cxx | 4 +- libbuild2/config/utility.cxx | 6 +- libbuild2/cxx/init.cxx | 143 +++++++++++++++++++++--------------------- libbuild2/dist/init.cxx | 2 +- libbuild2/file.cxx | 2 +- libbuild2/in/init.cxx | 2 +- libbuild2/install/init.cxx | 33 +++++----- libbuild2/install/utility.hxx | 4 +- libbuild2/module.cxx | 4 +- libbuild2/parser.cxx | 6 +- libbuild2/scope.hxx | 4 +- libbuild2/test/init.cxx | 2 +- libbuild2/version/init.cxx | 2 +- 17 files changed, 213 insertions(+), 215 deletions(-) (limited to 'libbuild2') diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx index a4d51e5..2bb96e8 100644 --- a/libbuild2/bin/init.cxx +++ b/libbuild2/bin/init.cxx @@ -57,7 +57,7 @@ namespace build2 // Target is a string and not target_triplet because it can be // specified by the user. // - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); const auto vis_tgt (variable_visibility::target); const auto vis_prj (variable_visibility::project); @@ -583,13 +583,13 @@ namespace build2 // if (first) { - auto& v (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); - v.insert ("bin.ar.path"); - v.insert ("bin.ranlib.path"); + vp.insert ("bin.ar.path"); + vp.insert ("bin.ranlib.path"); - v.insert ("config.bin.ar", true); - v.insert ("config.bin.ranlib", true); + vp.insert ("config.bin.ar", true); + vp.insert ("config.bin.ranlib", true); } // Configure. @@ -751,10 +751,10 @@ namespace build2 // if (first) { - auto& v (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); - v.insert ("bin.ld.path"); - v.insert ("config.bin.ld", true); + vp.insert ("bin.ld.path"); + vp.insert ("config.bin.ld", true); } // Configure. @@ -857,10 +857,10 @@ namespace build2 // if (first) { - auto& v (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); - v.insert ("bin.rc.path"); - v.insert ("config.bin.rc", true); + vp.insert ("bin.rc.path"); + vp.insert ("config.bin.rc", true); } // Configure. diff --git a/libbuild2/c/init.cxx b/libbuild2/c/init.cxx index 4efba69..a220169 100644 --- a/libbuild2/c/init.cxx +++ b/libbuild2/c/init.cxx @@ -150,7 +150,7 @@ namespace build2 // Enter all the variables and initialize the module data. // - auto& v (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); cc::config_data d { cc::lang::c, @@ -166,97 +166,97 @@ namespace build2 // // NOTE: remember to update documentation if changing anything here. // - v.insert ("config.c", true), - v.insert ("config.c.id", true), - v.insert ("config.c.version", true), - v.insert ("config.c.target", true), - v.insert ("config.c.std", true), - v.insert ("config.c.poptions", true), - v.insert ("config.c.coptions", true), - v.insert ("config.c.loptions", true), - v.insert ("config.c.aoptions", true), - v.insert ("config.c.libs", true), + vp.insert ("config.c", true), + vp.insert ("config.c.id", true), + vp.insert ("config.c.version", true), + vp.insert ("config.c.target", true), + vp.insert ("config.c.std", true), + vp.insert ("config.c.poptions", true), + vp.insert ("config.c.coptions", true), + vp.insert ("config.c.loptions", true), + vp.insert ("config.c.aoptions", true), + vp.insert ("config.c.libs", true), nullptr /* config.c.translatable_headers */, - v.insert ("c.path"), - v.insert ("c.mode"), - v.insert ("c.sys_lib_dirs"), - v.insert ("c.sys_inc_dirs"), + vp.insert ("c.path"), + vp.insert ("c.mode"), + vp.insert ("c.sys_lib_dirs"), + vp.insert ("c.sys_inc_dirs"), - v.insert ("c.std", variable_visibility::project), + vp.insert ("c.std", variable_visibility::project), - v.insert ("c.poptions"), - v.insert ("c.coptions"), - v.insert ("c.loptions"), - v.insert ("c.aoptions"), - v.insert ("c.libs"), + vp.insert ("c.poptions"), + vp.insert ("c.coptions"), + vp.insert ("c.loptions"), + vp.insert ("c.aoptions"), + vp.insert ("c.libs"), nullptr /* c.translatable_headers */, - v["cc.poptions"], - v["cc.coptions"], - v["cc.loptions"], - v["cc.aoptions"], - v["cc.libs"], + vp["cc.poptions"], + vp["cc.coptions"], + vp["cc.loptions"], + vp["cc.aoptions"], + vp["cc.libs"], - v.insert ("c.export.poptions"), - v.insert ("c.export.coptions"), - v.insert ("c.export.loptions"), - v.insert> ("c.export.libs"), + vp.insert ("c.export.poptions"), + vp.insert ("c.export.coptions"), + vp.insert ("c.export.loptions"), + vp.insert> ("c.export.libs"), - v["cc.export.poptions"], - v["cc.export.coptions"], - v["cc.export.loptions"], - v["cc.export.libs"], + vp["cc.export.poptions"], + vp["cc.export.coptions"], + vp["cc.export.loptions"], + vp["cc.export.libs"], - v.insert_alias (v["cc.stdlib"], "c.stdlib"), // Same as cc.stdlib. + vp.insert_alias (vp["cc.stdlib"], "c.stdlib"), // Same as cc.stdlib. - v["cc.runtime"], - v["cc.stdlib"], + vp["cc.runtime"], + vp["cc.stdlib"], - v["cc.type"], - v["cc.system"], - v["cc.module_name"], - v["cc.reprocess"], + vp["cc.type"], + vp["cc.system"], + vp["cc.module_name"], + vp["cc.reprocess"], - v.insert ("c.preprocessed"), // See cxx.preprocessed. - nullptr, // No __symexport (no modules). + vp.insert ("c.preprocessed"), // See cxx.preprocessed. + nullptr, // No __symexport (no modules). - v.insert ("c.id"), - v.insert ("c.id.type"), - v.insert ("c.id.variant"), + vp.insert ("c.id"), + vp.insert ("c.id.type"), + vp.insert ("c.id.variant"), - v.insert ("c.class"), + vp.insert ("c.class"), - &v.insert ("c.version"), - &v.insert ("c.version.major"), - &v.insert ("c.version.minor"), - &v.insert ("c.version.patch"), - &v.insert ("c.version.build"), + &vp.insert ("c.version"), + &vp.insert ("c.version.major"), + &vp.insert ("c.version.minor"), + &vp.insert ("c.version.patch"), + &vp.insert ("c.version.build"), - &v.insert ("c.variant_version"), - &v.insert ("c.variant_version.major"), - &v.insert ("c.variant_version.minor"), - &v.insert ("c.variant_version.patch"), - &v.insert ("c.variant_version.build"), + &vp.insert ("c.variant_version"), + &vp.insert ("c.variant_version.major"), + &vp.insert ("c.variant_version.minor"), + &vp.insert ("c.variant_version.patch"), + &vp.insert ("c.variant_version.build"), - v.insert ("c.signature"), - v.insert ("c.checksum"), + vp.insert ("c.signature"), + vp.insert ("c.checksum"), - v.insert ("c.pattern"), + vp.insert ("c.pattern"), - v.insert ("c.target"), + vp.insert ("c.target"), - v.insert ("c.target.cpu"), - v.insert ("c.target.vendor"), - v.insert ("c.target.system"), - v.insert ("c.target.version"), - v.insert ("c.target.class") + vp.insert ("c.target.cpu"), + vp.insert ("c.target.vendor"), + vp.insert ("c.target.system"), + vp.insert ("c.target.version"), + vp.insert ("c.target.class") }; // Alias some cc. variables as c. // - v.insert_alias (d.c_runtime, "c.runtime"); + vp.insert_alias (d.c_runtime, "c.runtime"); assert (mod == nullptr); config_module* m (new config_module (move (d))); diff --git a/libbuild2/cc/init.cxx b/libbuild2/cc/init.cxx index a495519..0536e0f 100644 --- a/libbuild2/cc/init.cxx +++ b/libbuild2/cc/init.cxx @@ -78,41 +78,41 @@ namespace build2 // Enter variables. Note: some overridable, some not. // - auto& v (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); auto v_t (variable_visibility::target); // NOTE: remember to update documentation if changing anything here. // - v.insert ("config.cc.poptions", true); - v.insert ("config.cc.coptions", true); - v.insert ("config.cc.loptions", true); - v.insert ("config.cc.aoptions", true); - v.insert ("config.cc.libs", true); + vp.insert ("config.cc.poptions", true); + vp.insert ("config.cc.coptions", true); + vp.insert ("config.cc.loptions", true); + vp.insert ("config.cc.aoptions", true); + vp.insert ("config.cc.libs", true); - v.insert ("cc.poptions"); - v.insert ("cc.coptions"); - v.insert ("cc.loptions"); - v.insert ("cc.aoptions"); - v.insert ("cc.libs"); + vp.insert ("cc.poptions"); + vp.insert ("cc.coptions"); + vp.insert ("cc.loptions"); + vp.insert ("cc.aoptions"); + vp.insert ("cc.libs"); - v.insert ("cc.export.poptions"); - v.insert ("cc.export.coptions"); - v.insert ("cc.export.loptions"); - v.insert> ("cc.export.libs"); + vp.insert ("cc.export.poptions"); + vp.insert ("cc.export.coptions"); + vp.insert ("cc.export.loptions"); + vp.insert> ("cc.export.libs"); // Hint variables (not overridable). // - v.insert ("config.cc.id"); - v.insert ("config.cc.hinter"); // Hinting module. - v.insert ("config.cc.pattern"); - v.insert ("config.cc.mode"); - v.insert ("config.cc.target"); + vp.insert ("config.cc.id"); + vp.insert ("config.cc.hinter"); // Hinting module. + vp.insert ("config.cc.pattern"); + vp.insert ("config.cc.mode"); + vp.insert ("config.cc.target"); // Compiler runtime and C standard library. // - v.insert ("cc.runtime"); - v.insert ("cc.stdlib"); + vp.insert ("cc.runtime"); + vp.insert ("cc.stdlib"); // Target type, for example, "C library" or "C++ library". Should be set // on the target as a rule-specific variable by the matching rule to the @@ -124,23 +124,23 @@ namespace build2 // but specific language is not known. Used in the import installed // logic. // - v.insert ("cc.type", v_t); + vp.insert ("cc.type", v_t); // If set and is true, then this (imported) library has been found in a // system library search directory. // - v.insert ("cc.system", v_t); + vp.insert ("cc.system", v_t); // C++ module name. Set on the bmi*{} target as a rule-specific variable // by the matching rule. Can also be set by the user (normally via the // x.module_name alias) on the x_mod{} source. // - v.insert ("cc.module_name", v_t); + vp.insert ("cc.module_name", v_t); // Ability to disable using preprocessed output for compilation. // - v.insert ("config.cc.reprocess", true); - v.insert ("cc.reprocess"); + vp.insert ("config.cc.reprocess", true); + vp.insert ("cc.reprocess"); // Register scope operation callback. // diff --git a/libbuild2/cc/module.cxx b/libbuild2/cc/module.cxx index 95b42bd..69530a2 100644 --- a/libbuild2/cc/module.cxx +++ b/libbuild2/cc/module.cxx @@ -41,7 +41,7 @@ namespace build2 config::save_module (rs, x, 250); - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); // Must already exist. // diff --git a/libbuild2/config/init.cxx b/libbuild2/config/init.cxx index 56aed15..a7f3fc3 100644 --- a/libbuild2/config/init.cxx +++ b/libbuild2/config/init.cxx @@ -45,7 +45,7 @@ namespace build2 // not be valid module names (`build`). We also currently treat `import` // as special. // - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); // While config.config.load (see below) could theoretically be specified // in a buildfile, config.config.save is expected to always be specified @@ -166,7 +166,7 @@ namespace build2 assert (config_hints.empty ()); // We don't known any hints. - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); auto& c_l (vp.insert ("config.config.load", true /* ovr */)); auto& c_v (vp.insert ("config.version", false /*ovr*/)); diff --git a/libbuild2/config/utility.cxx b/libbuild2/config/utility.cxx index 34220f8..fd87c39 100644 --- a/libbuild2/config/utility.cxx +++ b/libbuild2/config/utility.cxx @@ -74,7 +74,7 @@ namespace build2 // any original values, they will be "visible"; see find_override() for // details. // - const variable& vns (rs.ctx.var_pool.rw (rs).insert ("config." + n)); + const variable& vns (rs.var_pool ().insert ("config." + n)); for (scope* s (&rs); s != nullptr; s = s->parent_scope ()) { for (auto p (s->vars.find_namespace (vns)); @@ -100,7 +100,7 @@ namespace build2 // Pattern-typed in boot() as bool. // const variable& var ( - rs.ctx.var_pool.rw (rs).insert ("config." + n + ".configured")); + rs.var_pool ().insert ("config." + n + ".configured")); save_variable (rs, var); @@ -114,7 +114,7 @@ namespace build2 // Pattern-typed in boot() as bool. // const variable& var ( - rs.ctx.var_pool.rw (rs).insert ("config." + n + ".configured")); + rs.var_pool ().insert ("config." + n + ".configured")); save_variable (rs, var); diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx index d2601c4..cf27aaa 100644 --- a/libbuild2/cxx/init.cxx +++ b/libbuild2/cxx/init.cxx @@ -91,8 +91,7 @@ namespace build2 // auto enter = [&rs] (const char* v) -> const variable& { - return rs.ctx.var_pool.rw (rs).insert ( - v, variable_visibility::project); + return rs.var_pool ().insert (v, variable_visibility::project); }; //bool concepts (false); auto& v_c (enter ("cxx.features.concepts")); @@ -373,7 +372,7 @@ namespace build2 // Enter all the variables and initialize the module data. // - auto& v (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); cc::config_data d { cc::lang::cxx, @@ -389,16 +388,16 @@ namespace build2 // // NOTE: remember to update documentation if changing anything here. // - v.insert ("config.cxx", true), - v.insert ("config.cxx.id", true), - v.insert ("config.cxx.version", true), - v.insert ("config.cxx.target", true), - v.insert ("config.cxx.std", true), - v.insert ("config.cxx.poptions", true), - v.insert ("config.cxx.coptions", true), - v.insert ("config.cxx.loptions", true), - v.insert ("config.cxx.aoptions", true), - v.insert ("config.cxx.libs", true), + vp.insert ("config.cxx", true), + vp.insert ("config.cxx.id", true), + vp.insert ("config.cxx.version", true), + vp.insert ("config.cxx.target", true), + vp.insert ("config.cxx.std", true), + vp.insert ("config.cxx.poptions", true), + vp.insert ("config.cxx.coptions", true), + vp.insert ("config.cxx.loptions", true), + vp.insert ("config.cxx.aoptions", true), + vp.insert ("config.cxx.libs", true), // List of translatable headers. Inclusions of such headers are // translated to the corresponding header unit imports. @@ -409,48 +408,48 @@ namespace build2 // opposed to -I) header search paths. Note also that all entries must // be specified before loading the cxx module. // - &v.insert ("config.cxx.translatable_headers", true), + &vp.insert ("config.cxx.translatable_headers", true), - v.insert ("cxx.path"), - v.insert ("cxx.mode"), - v.insert ("cxx.sys_lib_dirs"), - v.insert ("cxx.sys_inc_dirs"), + vp.insert ("cxx.path"), + vp.insert ("cxx.mode"), + vp.insert ("cxx.sys_lib_dirs"), + vp.insert ("cxx.sys_inc_dirs"), - v.insert ("cxx.std", variable_visibility::project), + vp.insert ("cxx.std", variable_visibility::project), - v.insert ("cxx.poptions"), - v.insert ("cxx.coptions"), - v.insert ("cxx.loptions"), - v.insert ("cxx.aoptions"), - v.insert ("cxx.libs"), + vp.insert ("cxx.poptions"), + vp.insert ("cxx.coptions"), + vp.insert ("cxx.loptions"), + vp.insert ("cxx.aoptions"), + vp.insert ("cxx.libs"), - &v.insert ("cxx.translatable_headers"), + &vp.insert ("cxx.translatable_headers"), - v["cc.poptions"], - v["cc.coptions"], - v["cc.loptions"], - v["cc.aoptions"], - v["cc.libs"], + vp["cc.poptions"], + vp["cc.coptions"], + vp["cc.loptions"], + vp["cc.aoptions"], + vp["cc.libs"], - v.insert ("cxx.export.poptions"), - v.insert ("cxx.export.coptions"), - v.insert ("cxx.export.loptions"), - v.insert> ("cxx.export.libs"), + vp.insert ("cxx.export.poptions"), + vp.insert ("cxx.export.coptions"), + vp.insert ("cxx.export.loptions"), + vp.insert> ("cxx.export.libs"), - v["cc.export.poptions"], - v["cc.export.coptions"], - v["cc.export.loptions"], - v["cc.export.libs"], + vp["cc.export.poptions"], + vp["cc.export.coptions"], + vp["cc.export.loptions"], + vp["cc.export.libs"], - v.insert ("cxx.stdlib"), + vp.insert ("cxx.stdlib"), - v["cc.runtime"], - v["cc.stdlib"], + vp["cc.runtime"], + vp["cc.stdlib"], - v["cc.type"], - v["cc.system"], - v["cc.module_name"], - v["cc.reprocess"], + vp["cc.type"], + vp["cc.system"], + vp["cc.module_name"], + vp["cc.reprocess"], // Ability to signal that source is already (partially) preprocessed. // Valid values are 'none' (not preprocessed), 'includes' (no #include @@ -464,46 +463,46 @@ namespace build2 // What about header unit imports? Well, they are in a sense // standardized precompiled headers so we treat them as includes. // - v.insert ("cxx.preprocessed"), + vp.insert ("cxx.preprocessed"), nullptr, // cxx.features.symexport (set in init() below). - v.insert ("cxx.id"), - v.insert ("cxx.id.type"), - v.insert ("cxx.id.variant"), + vp.insert ("cxx.id"), + vp.insert ("cxx.id.type"), + vp.insert ("cxx.id.variant"), - v.insert ("cxx.class"), + vp.insert ("cxx.class"), - &v.insert ("cxx.version"), - &v.insert ("cxx.version.major"), - &v.insert ("cxx.version.minor"), - &v.insert ("cxx.version.patch"), - &v.insert ("cxx.version.build"), + &vp.insert ("cxx.version"), + &vp.insert ("cxx.version.major"), + &vp.insert ("cxx.version.minor"), + &vp.insert ("cxx.version.patch"), + &vp.insert ("cxx.version.build"), - &v.insert ("cxx.variant_version"), - &v.insert ("cxx.variant_version.major"), - &v.insert ("cxx.variant_version.minor"), - &v.insert ("cxx.variant_version.patch"), - &v.insert ("cxx.variant_version.build"), + &vp.insert ("cxx.variant_version"), + &vp.insert ("cxx.variant_version.major"), + &vp.insert ("cxx.variant_version.minor"), + &vp.insert ("cxx.variant_version.patch"), + &vp.insert ("cxx.variant_version.build"), - v.insert ("cxx.signature"), - v.insert ("cxx.checksum"), + vp.insert ("cxx.signature"), + vp.insert ("cxx.checksum"), - v.insert ("cxx.pattern"), + vp.insert ("cxx.pattern"), - v.insert ("cxx.target"), + vp.insert ("cxx.target"), - v.insert ("cxx.target.cpu"), - v.insert ("cxx.target.vendor"), - v.insert ("cxx.target.system"), - v.insert ("cxx.target.version"), - v.insert ("cxx.target.class") + vp.insert ("cxx.target.cpu"), + vp.insert ("cxx.target.vendor"), + vp.insert ("cxx.target.system"), + vp.insert ("cxx.target.version"), + vp.insert ("cxx.target.class") }; // Alias some cc. variables as cxx. // - v.insert_alias (d.c_runtime, "cxx.runtime"); - v.insert_alias (d.c_module_name, "cxx.module_name"); + vp.insert_alias (d.c_runtime, "cxx.runtime"); + vp.insert_alias (d.c_module_name, "cxx.module_name"); assert (mod == nullptr); config_module* m (new config_module (move (d))); @@ -583,7 +582,7 @@ namespace build2 config_module& cm (*rs.find_module ("cxx.guess")); - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); bool modules (cast (rs["cxx.features.modules"])); diff --git a/libbuild2/dist/init.cxx b/libbuild2/dist/init.cxx index efbd5d7..93bcfdb 100644 --- a/libbuild2/dist/init.cxx +++ b/libbuild2/dist/init.cxx @@ -37,7 +37,7 @@ namespace build2 // Enter module variables. Do it during boot in case they get assigned // in bootstrap.build (which is customary for, e.g., dist.package). // - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); // Note: some overridable, some not. // diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx index be85745..e6975cd 100644 --- a/libbuild2/file.cxx +++ b/libbuild2/file.cxx @@ -1343,7 +1343,7 @@ namespace build2 // over anything that we may discover. In particular, we will prefer it // over any bundled subprojects. // - auto& vp (ctx.var_pool.rw (iroot)); + auto& vp (iroot.var_pool ()); for (;;) // Break-out loop. { diff --git a/libbuild2/in/init.cxx b/libbuild2/in/init.cxx index 80508b6..debdb45 100644 --- a/libbuild2/in/init.cxx +++ b/libbuild2/in/init.cxx @@ -36,7 +36,7 @@ namespace build2 // Enter variables. // { - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); // Alternative variable substitution symbol with '$' being the // default. diff --git a/libbuild2/install/init.cxx b/libbuild2/install/init.cxx index 98eec91..fdcc627 100644 --- a/libbuild2/install/init.cxx +++ b/libbuild2/install/init.cxx @@ -40,7 +40,7 @@ namespace build2 template static void set_var (bool spec, - scope& r, + scope& rs, const char* name, const char* var, const CT* dv, @@ -62,13 +62,13 @@ namespace build2 vn += name; } vn += var; - const variable& vr (r.ctx.var_pool.rw (r).insert (move (vn), true)); + const variable& vr (rs.var_pool ().insert (move (vn), true)); l = dv != nullptr - ? config::required (r, vr, *dv, override).first + ? config::required (rs, vr, *dv, override).first : (global - ? config::optional (r, vr) - : config::omitted (r, vr).first); + ? config::optional (rs, vr) + : config::omitted (rs, vr).first); } if (global) @@ -79,9 +79,9 @@ namespace build2 vn = "install."; vn += name; vn += var; - const variable& vr (r.ctx.var_pool.rw (r).insert (move (vn))); + const variable& vr (rs.var_pool ().insert (move (vn))); - value& v (r.assign (vr)); + value& v (rs.assign (vr)); if (spec) { @@ -98,7 +98,7 @@ namespace build2 template static void set_dir (bool s, // specified - scope& r, // root scope + scope& rs, // root scope const char* n, // var name const T& p, // path bool o = false, // override @@ -111,19 +111,18 @@ namespace build2 bool global (*n == '\0'); if (!global) - set_var (s, r, n, "", p.empty () ? nullptr : &p, o); + set_var (s, rs, n, "", p.empty () ? nullptr : &p, o); - set_var (s, r, n, ".cmd", c.empty () ? nullptr : &c); - set_var (s, r, n, ".options", (strings*) (nullptr)); - set_var (s, r, n, ".mode", fm.empty () ? nullptr : &fm); - set_var (s, r, n, ".dir_mode", dm.empty () ? nullptr : &dm); - set_var (s, r, n, ".sudo", (string*) (nullptr)); + set_var (s, rs, n, ".cmd", c.empty () ? nullptr : &c); + set_var (s, rs, n, ".options", (strings*) (nullptr)); + set_var (s, rs, n, ".mode", fm.empty () ? nullptr : &fm); + set_var (s, rs, n, ".dir_mode", dm.empty () ? nullptr : &dm); + set_var (s, rs, n, ".sudo", (string*) (nullptr)); // This one doesn't have config.* value (only set in a buildfile). // if (!global) - r.ctx.var_pool.rw (r).insert ( - string ("install.") + n + ".subdirs"); + rs.var_pool ().insert (string ("install.") + n + ".subdirs"); } void @@ -194,7 +193,7 @@ namespace build2 // Enter module variables. // - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); // Note that the set_dir() calls below enter some more. // diff --git a/libbuild2/install/utility.hxx b/libbuild2/install/utility.hxx index 24c82d8..fae7c43 100644 --- a/libbuild2/install/utility.hxx +++ b/libbuild2/install/utility.hxx @@ -24,7 +24,7 @@ namespace build2 { auto r ( s.target_vars[tt]["*"].insert ( - s.ctx.var_pool.rw (s).insert ("install"))); + s.var_pool ().insert ("install"))); if (r.second) // Already set by the user? r.first.get () = path_cast (move (d)); @@ -42,7 +42,7 @@ namespace build2 { auto r ( s.target_vars[tt]["*"].insert ( - s.ctx.var_pool.rw (s).insert ("install.mode"))); + s.var_pool ().insert ("install.mode"))); if (r.second) // Already set by the user? r.first.get () = move (m); diff --git a/libbuild2/module.cxx b/libbuild2/module.cxx index 9bc79ab..cc79af0 100644 --- a/libbuild2/module.cxx +++ b/libbuild2/module.cxx @@ -523,7 +523,7 @@ namespace build2 module_state {true, false, mf.init, nullptr, loc}).first; i->second.first = mf.boot (rs, loc, i->second.module); - rs.assign (rs.ctx.var_pool.rw (rs).insert (mod + ".booted")) = true; + rs.assign (rs.var_pool ().insert (mod + ".booted")) = true; } module_state* @@ -574,7 +574,7 @@ namespace build2 // buildfile-visible (where we use the term "load a module"; see the note // on terminology above) // - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); value& lv (bs.assign (vp.insert (mod + ".loaded"))); value& cv (bs.assign (vp.insert (mod + ".configured"))); diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index 2631845..65493bd 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -1714,7 +1714,7 @@ namespace build2 // Is this the 'foo=...' case? // size_t p (t.value.find ('=')); - auto& vp (ctx.var_pool.rw (*scope_)); + auto& vp (scope_->var_pool ()); if (p != string::npos) var = &vp.insert (split (p), true /* overridable */); @@ -2748,7 +2748,7 @@ namespace build2 //@@ TODO: append namespace if any. } - return ctx.var_pool.rw (*scope_).insert (move (n), true /* overridable */); + return scope_->var_pool ().insert (move (n), true /* overridable */); } void parser:: @@ -5739,7 +5739,7 @@ namespace build2 // Lookup. // - const auto& var (ctx.var_pool.rw (*scope_).insert (move (name), true)); + const variable& var (scope_->var_pool ().insert (move (name), true)); if (p != nullptr) { diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx index ca21a17..dd2831c 100644 --- a/libbuild2/scope.hxx +++ b/libbuild2/scope.hxx @@ -169,7 +169,7 @@ namespace build2 value& assign (string name) { - return assign (ctx.var_pool.rw (*this).insert (move (name))); + return assign (var_pool ().insert (move (name))); } // Assign a typed non-overridable variable with normal visibility. @@ -178,7 +178,7 @@ namespace build2 value& assign (string name) { - return vars.assign (ctx.var_pool.rw (*this).insert (move (name))); + return vars.assign (var_pool ().insert (move (name))); } template diff --git a/libbuild2/test/init.cxx b/libbuild2/test/init.cxx index 3bcbe96..6a13990 100644 --- a/libbuild2/test/init.cxx +++ b/libbuild2/test/init.cxx @@ -39,7 +39,7 @@ namespace build2 // Enter module variables. Do it during boot in case they get assigned // in bootstrap.build. // - auto& vp (rs.ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); common_data d { diff --git a/libbuild2/version/init.cxx b/libbuild2/version/init.cxx index ea4c71a..f69e416 100644 --- a/libbuild2/version/init.cxx +++ b/libbuild2/version/init.cxx @@ -224,7 +224,7 @@ namespace build2 // Note also that we have "gifted" the config.version variable name to // the config module. // - auto& vp (ctx.var_pool.rw (rs)); + auto& vp (rs.var_pool ()); auto set = [&vp, &rs] (const char* var, auto val) { -- cgit v1.1