aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-01-28 08:41:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-01-28 08:41:57 +0200
commitccb417a7c1456427b76914e8a11ca87b4926eeb3 (patch)
treed68803a1a1a013b1bb50f845459d0145c221eb79
parentc0105aad0074aee0efb3ba41f8132496412f8790 (diff)
Use scope::var_pool()
-rw-r--r--build2/cli/init.cxx14
-rw-r--r--libbuild2/bin/init.cxx24
-rw-r--r--libbuild2/c/init.cxx134
-rw-r--r--libbuild2/cc/init.cxx54
-rw-r--r--libbuild2/cc/module.cxx2
-rw-r--r--libbuild2/config/init.cxx4
-rw-r--r--libbuild2/config/utility.cxx6
-rw-r--r--libbuild2/cxx/init.cxx143
-rw-r--r--libbuild2/dist/init.cxx2
-rw-r--r--libbuild2/file.cxx2
-rw-r--r--libbuild2/in/init.cxx2
-rw-r--r--libbuild2/install/init.cxx33
-rw-r--r--libbuild2/install/utility.hxx4
-rw-r--r--libbuild2/module.cxx4
-rw-r--r--libbuild2/parser.cxx6
-rw-r--r--libbuild2/scope.hxx4
-rw-r--r--libbuild2/test/init.cxx2
-rw-r--r--libbuild2/version/init.cxx2
18 files changed, 220 insertions, 222 deletions
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index 23ebd83..6125f25 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -43,22 +43,22 @@ namespace build2
//
if (first)
{
- auto& v (rs.ctx.var_pool.rw (rs));
+ auto& vp (rs.var_pool ());
// Note: some overridable, some not.
//
// The config.cli=false is recognized as an explicit request to leave
// the module unconfigured.
//
- v.insert<path> ("config.cli", true);
- v.insert<strings> ("config.cli.options", true);
+ vp.insert<path> ("config.cli", true);
+ vp.insert<strings> ("config.cli.options", true);
//@@ TODO: split version into componets (it is stdver).
//
- v.insert<process_path> ("cli.path");
- v.insert<string> ("cli.version");
- v.insert<string> ("cli.checksum");
- v.insert<strings> ("cli.options");
+ vp.insert<process_path> ("cli.path");
+ vp.insert<string> ("cli.version");
+ vp.insert<string> ("cli.checksum");
+ vp.insert<strings> ("cli.options");
}
// Configure.
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<process_path> ("bin.ar.path");
- v.insert<process_path> ("bin.ranlib.path");
+ vp.insert<process_path> ("bin.ar.path");
+ vp.insert<process_path> ("bin.ranlib.path");
- v.insert<path> ("config.bin.ar", true);
- v.insert<path> ("config.bin.ranlib", true);
+ vp.insert<path> ("config.bin.ar", true);
+ vp.insert<path> ("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<process_path> ("bin.ld.path");
- v.insert<path> ("config.bin.ld", true);
+ vp.insert<process_path> ("bin.ld.path");
+ vp.insert<path> ("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<process_path> ("bin.rc.path");
- v.insert<path> ("config.bin.rc", true);
+ vp.insert<process_path> ("bin.rc.path");
+ vp.insert<path> ("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<strings> ("config.c", true),
- v.insert<string> ("config.c.id", true),
- v.insert<string> ("config.c.version", true),
- v.insert<string> ("config.c.target", true),
- v.insert<string> ("config.c.std", true),
- v.insert<strings> ("config.c.poptions", true),
- v.insert<strings> ("config.c.coptions", true),
- v.insert<strings> ("config.c.loptions", true),
- v.insert<strings> ("config.c.aoptions", true),
- v.insert<strings> ("config.c.libs", true),
+ vp.insert<strings> ("config.c", true),
+ vp.insert<string> ("config.c.id", true),
+ vp.insert<string> ("config.c.version", true),
+ vp.insert<string> ("config.c.target", true),
+ vp.insert<string> ("config.c.std", true),
+ vp.insert<strings> ("config.c.poptions", true),
+ vp.insert<strings> ("config.c.coptions", true),
+ vp.insert<strings> ("config.c.loptions", true),
+ vp.insert<strings> ("config.c.aoptions", true),
+ vp.insert<strings> ("config.c.libs", true),
nullptr /* config.c.translatable_headers */,
- v.insert<process_path> ("c.path"),
- v.insert<strings> ("c.mode"),
- v.insert<dir_paths> ("c.sys_lib_dirs"),
- v.insert<dir_paths> ("c.sys_inc_dirs"),
+ vp.insert<process_path> ("c.path"),
+ vp.insert<strings> ("c.mode"),
+ vp.insert<dir_paths> ("c.sys_lib_dirs"),
+ vp.insert<dir_paths> ("c.sys_inc_dirs"),
- v.insert<string> ("c.std", variable_visibility::project),
+ vp.insert<string> ("c.std", variable_visibility::project),
- v.insert<strings> ("c.poptions"),
- v.insert<strings> ("c.coptions"),
- v.insert<strings> ("c.loptions"),
- v.insert<strings> ("c.aoptions"),
- v.insert<strings> ("c.libs"),
+ vp.insert<strings> ("c.poptions"),
+ vp.insert<strings> ("c.coptions"),
+ vp.insert<strings> ("c.loptions"),
+ vp.insert<strings> ("c.aoptions"),
+ vp.insert<strings> ("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<strings> ("c.export.poptions"),
- v.insert<strings> ("c.export.coptions"),
- v.insert<strings> ("c.export.loptions"),
- v.insert<vector<name>> ("c.export.libs"),
+ vp.insert<strings> ("c.export.poptions"),
+ vp.insert<strings> ("c.export.coptions"),
+ vp.insert<strings> ("c.export.loptions"),
+ vp.insert<vector<name>> ("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<string> ("c.preprocessed"), // See cxx.preprocessed.
- nullptr, // No __symexport (no modules).
+ vp.insert<string> ("c.preprocessed"), // See cxx.preprocessed.
+ nullptr, // No __symexport (no modules).
- v.insert<string> ("c.id"),
- v.insert<string> ("c.id.type"),
- v.insert<string> ("c.id.variant"),
+ vp.insert<string> ("c.id"),
+ vp.insert<string> ("c.id.type"),
+ vp.insert<string> ("c.id.variant"),
- v.insert<string> ("c.class"),
+ vp.insert<string> ("c.class"),
- &v.insert<string> ("c.version"),
- &v.insert<uint64_t> ("c.version.major"),
- &v.insert<uint64_t> ("c.version.minor"),
- &v.insert<uint64_t> ("c.version.patch"),
- &v.insert<string> ("c.version.build"),
+ &vp.insert<string> ("c.version"),
+ &vp.insert<uint64_t> ("c.version.major"),
+ &vp.insert<uint64_t> ("c.version.minor"),
+ &vp.insert<uint64_t> ("c.version.patch"),
+ &vp.insert<string> ("c.version.build"),
- &v.insert<string> ("c.variant_version"),
- &v.insert<uint64_t> ("c.variant_version.major"),
- &v.insert<uint64_t> ("c.variant_version.minor"),
- &v.insert<uint64_t> ("c.variant_version.patch"),
- &v.insert<string> ("c.variant_version.build"),
+ &vp.insert<string> ("c.variant_version"),
+ &vp.insert<uint64_t> ("c.variant_version.major"),
+ &vp.insert<uint64_t> ("c.variant_version.minor"),
+ &vp.insert<uint64_t> ("c.variant_version.patch"),
+ &vp.insert<string> ("c.variant_version.build"),
- v.insert<string> ("c.signature"),
- v.insert<string> ("c.checksum"),
+ vp.insert<string> ("c.signature"),
+ vp.insert<string> ("c.checksum"),
- v.insert<string> ("c.pattern"),
+ vp.insert<string> ("c.pattern"),
- v.insert<target_triplet> ("c.target"),
+ vp.insert<target_triplet> ("c.target"),
- v.insert<string> ("c.target.cpu"),
- v.insert<string> ("c.target.vendor"),
- v.insert<string> ("c.target.system"),
- v.insert<string> ("c.target.version"),
- v.insert<string> ("c.target.class")
+ vp.insert<string> ("c.target.cpu"),
+ vp.insert<string> ("c.target.vendor"),
+ vp.insert<string> ("c.target.system"),
+ vp.insert<string> ("c.target.version"),
+ vp.insert<string> ("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<strings> ("config.cc.poptions", true);
- v.insert<strings> ("config.cc.coptions", true);
- v.insert<strings> ("config.cc.loptions", true);
- v.insert<strings> ("config.cc.aoptions", true);
- v.insert<strings> ("config.cc.libs", true);
+ vp.insert<strings> ("config.cc.poptions", true);
+ vp.insert<strings> ("config.cc.coptions", true);
+ vp.insert<strings> ("config.cc.loptions", true);
+ vp.insert<strings> ("config.cc.aoptions", true);
+ vp.insert<strings> ("config.cc.libs", true);
- v.insert<strings> ("cc.poptions");
- v.insert<strings> ("cc.coptions");
- v.insert<strings> ("cc.loptions");
- v.insert<strings> ("cc.aoptions");
- v.insert<strings> ("cc.libs");
+ vp.insert<strings> ("cc.poptions");
+ vp.insert<strings> ("cc.coptions");
+ vp.insert<strings> ("cc.loptions");
+ vp.insert<strings> ("cc.aoptions");
+ vp.insert<strings> ("cc.libs");
- v.insert<strings> ("cc.export.poptions");
- v.insert<strings> ("cc.export.coptions");
- v.insert<strings> ("cc.export.loptions");
- v.insert<vector<name>> ("cc.export.libs");
+ vp.insert<strings> ("cc.export.poptions");
+ vp.insert<strings> ("cc.export.coptions");
+ vp.insert<strings> ("cc.export.loptions");
+ vp.insert<vector<name>> ("cc.export.libs");
// Hint variables (not overridable).
//
- v.insert<string> ("config.cc.id");
- v.insert<string> ("config.cc.hinter"); // Hinting module.
- v.insert<string> ("config.cc.pattern");
- v.insert<strings> ("config.cc.mode");
- v.insert<target_triplet> ("config.cc.target");
+ vp.insert<string> ("config.cc.id");
+ vp.insert<string> ("config.cc.hinter"); // Hinting module.
+ vp.insert<string> ("config.cc.pattern");
+ vp.insert<strings> ("config.cc.mode");
+ vp.insert<target_triplet> ("config.cc.target");
// Compiler runtime and C standard library.
//
- v.insert<string> ("cc.runtime");
- v.insert<string> ("cc.stdlib");
+ vp.insert<string> ("cc.runtime");
+ vp.insert<string> ("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<string> ("cc.type", v_t);
+ vp.insert<string> ("cc.type", v_t);
// If set and is true, then this (imported) library has been found in a
// system library search directory.
//
- v.insert<bool> ("cc.system", v_t);
+ vp.insert<bool> ("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<string> ("cc.module_name", v_t);
+ vp.insert<string> ("cc.module_name", v_t);
// Ability to disable using preprocessed output for compilation.
//
- v.insert<bool> ("config.cc.reprocess", true);
- v.insert<bool> ("cc.reprocess");
+ vp.insert<bool> ("config.cc.reprocess", true);
+ vp.insert<bool> ("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<paths> ("config.config.load", true /* ovr */));
auto& c_v (vp.insert<uint64_t> ("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<bool> (
- v, variable_visibility::project);
+ return rs.var_pool ().insert<bool> (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<strings> ("config.cxx", true),
- v.insert<string> ("config.cxx.id", true),
- v.insert<string> ("config.cxx.version", true),
- v.insert<string> ("config.cxx.target", true),
- v.insert<string> ("config.cxx.std", true),
- v.insert<strings> ("config.cxx.poptions", true),
- v.insert<strings> ("config.cxx.coptions", true),
- v.insert<strings> ("config.cxx.loptions", true),
- v.insert<strings> ("config.cxx.aoptions", true),
- v.insert<strings> ("config.cxx.libs", true),
+ vp.insert<strings> ("config.cxx", true),
+ vp.insert<string> ("config.cxx.id", true),
+ vp.insert<string> ("config.cxx.version", true),
+ vp.insert<string> ("config.cxx.target", true),
+ vp.insert<string> ("config.cxx.std", true),
+ vp.insert<strings> ("config.cxx.poptions", true),
+ vp.insert<strings> ("config.cxx.coptions", true),
+ vp.insert<strings> ("config.cxx.loptions", true),
+ vp.insert<strings> ("config.cxx.aoptions", true),
+ vp.insert<strings> ("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<strings> ("config.cxx.translatable_headers", true),
+ &vp.insert<strings> ("config.cxx.translatable_headers", true),
- v.insert<process_path> ("cxx.path"),
- v.insert<strings> ("cxx.mode"),
- v.insert<dir_paths> ("cxx.sys_lib_dirs"),
- v.insert<dir_paths> ("cxx.sys_inc_dirs"),
+ vp.insert<process_path> ("cxx.path"),
+ vp.insert<strings> ("cxx.mode"),
+ vp.insert<dir_paths> ("cxx.sys_lib_dirs"),
+ vp.insert<dir_paths> ("cxx.sys_inc_dirs"),
- v.insert<string> ("cxx.std", variable_visibility::project),
+ vp.insert<string> ("cxx.std", variable_visibility::project),
- v.insert<strings> ("cxx.poptions"),
- v.insert<strings> ("cxx.coptions"),
- v.insert<strings> ("cxx.loptions"),
- v.insert<strings> ("cxx.aoptions"),
- v.insert<strings> ("cxx.libs"),
+ vp.insert<strings> ("cxx.poptions"),
+ vp.insert<strings> ("cxx.coptions"),
+ vp.insert<strings> ("cxx.loptions"),
+ vp.insert<strings> ("cxx.aoptions"),
+ vp.insert<strings> ("cxx.libs"),
- &v.insert<strings> ("cxx.translatable_headers"),
+ &vp.insert<strings> ("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<strings> ("cxx.export.poptions"),
- v.insert<strings> ("cxx.export.coptions"),
- v.insert<strings> ("cxx.export.loptions"),
- v.insert<vector<name>> ("cxx.export.libs"),
+ vp.insert<strings> ("cxx.export.poptions"),
+ vp.insert<strings> ("cxx.export.coptions"),
+ vp.insert<strings> ("cxx.export.loptions"),
+ vp.insert<vector<name>> ("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<string> ("cxx.stdlib"),
+ vp.insert<string> ("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<string> ("cxx.preprocessed"),
+ vp.insert<string> ("cxx.preprocessed"),
nullptr, // cxx.features.symexport (set in init() below).
- v.insert<string> ("cxx.id"),
- v.insert<string> ("cxx.id.type"),
- v.insert<string> ("cxx.id.variant"),
+ vp.insert<string> ("cxx.id"),
+ vp.insert<string> ("cxx.id.type"),
+ vp.insert<string> ("cxx.id.variant"),
- v.insert<string> ("cxx.class"),
+ vp.insert<string> ("cxx.class"),
- &v.insert<string> ("cxx.version"),
- &v.insert<uint64_t> ("cxx.version.major"),
- &v.insert<uint64_t> ("cxx.version.minor"),
- &v.insert<uint64_t> ("cxx.version.patch"),
- &v.insert<string> ("cxx.version.build"),
+ &vp.insert<string> ("cxx.version"),
+ &vp.insert<uint64_t> ("cxx.version.major"),
+ &vp.insert<uint64_t> ("cxx.version.minor"),
+ &vp.insert<uint64_t> ("cxx.version.patch"),
+ &vp.insert<string> ("cxx.version.build"),
- &v.insert<string> ("cxx.variant_version"),
- &v.insert<uint64_t> ("cxx.variant_version.major"),
- &v.insert<uint64_t> ("cxx.variant_version.minor"),
- &v.insert<uint64_t> ("cxx.variant_version.patch"),
- &v.insert<string> ("cxx.variant_version.build"),
+ &vp.insert<string> ("cxx.variant_version"),
+ &vp.insert<uint64_t> ("cxx.variant_version.major"),
+ &vp.insert<uint64_t> ("cxx.variant_version.minor"),
+ &vp.insert<uint64_t> ("cxx.variant_version.patch"),
+ &vp.insert<string> ("cxx.variant_version.build"),
- v.insert<string> ("cxx.signature"),
- v.insert<string> ("cxx.checksum"),
+ vp.insert<string> ("cxx.signature"),
+ vp.insert<string> ("cxx.checksum"),
- v.insert<string> ("cxx.pattern"),
+ vp.insert<string> ("cxx.pattern"),
- v.insert<target_triplet> ("cxx.target"),
+ vp.insert<target_triplet> ("cxx.target"),
- v.insert<string> ("cxx.target.cpu"),
- v.insert<string> ("cxx.target.vendor"),
- v.insert<string> ("cxx.target.system"),
- v.insert<string> ("cxx.target.version"),
- v.insert<string> ("cxx.target.class")
+ vp.insert<string> ("cxx.target.cpu"),
+ vp.insert<string> ("cxx.target.vendor"),
+ vp.insert<string> ("cxx.target.system"),
+ vp.insert<string> ("cxx.target.version"),
+ vp.insert<string> ("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<config_module> ("cxx.guess"));
- auto& vp (rs.ctx.var_pool.rw (rs));
+ auto& vp (rs.var_pool ());
bool modules (cast<bool> (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 <typename T, typename CT>
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<CT> (move (vn), true));
+ const variable& vr (rs.var_pool ().insert<CT> (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<T> (move (vn)));
+ const variable& vr (rs.var_pool ().insert<T> (move (vn)));
- value& v (r.assign (vr));
+ value& v (rs.assign (vr));
if (spec)
{
@@ -98,7 +98,7 @@ namespace build2
template <typename T>
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<dir_path> (s, r, n, "", p.empty () ? nullptr : &p, o);
+ set_var<dir_path> (s, rs, n, "", p.empty () ? nullptr : &p, o);
- set_var<path> (s, r, n, ".cmd", c.empty () ? nullptr : &c);
- set_var<strings> (s, r, n, ".options", (strings*) (nullptr));
- set_var<string> (s, r, n, ".mode", fm.empty () ? nullptr : &fm);
- set_var<string> (s, r, n, ".dir_mode", dm.empty () ? nullptr : &dm);
- set_var<string> (s, r, n, ".sudo", (string*) (nullptr));
+ set_var<path> (s, rs, n, ".cmd", c.empty () ? nullptr : &c);
+ set_var<strings> (s, rs, n, ".options", (strings*) (nullptr));
+ set_var<string> (s, rs, n, ".mode", fm.empty () ? nullptr : &fm);
+ set_var<string> (s, rs, n, ".dir_mode", dm.empty () ? nullptr : &dm);
+ set_var<string> (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<bool> (
- string ("install.") + n + ".subdirs");
+ rs.var_pool ().insert<bool> (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<path> (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<T> (move (name)));
+ return vars.assign (var_pool ().insert<T> (move (name)));
}
template <typename T>
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)
{