aboutsummaryrefslogtreecommitdiff
path: root/build2/config
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-30 11:12:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-02-13 12:42:41 +0200
commitb262d2c9c56eed18d043dccefac02b54a6ae2f95 (patch)
tree010e5c6cce042e0fbf25817a62659d251c220acf /build2/config
parentf93038fbee1631b95922b0742e0fd00fa8dae02e (diff)
Implement pattern-based variable typing, tighten variable type update
Diffstat (limited to 'build2/config')
-rw-r--r--build2/config/init.cxx4
-rw-r--r--build2/config/utility6
-rw-r--r--build2/config/utility.cxx18
3 files changed, 17 insertions, 11 deletions
diff --git a/build2/config/init.cxx b/build2/config/init.cxx
index 1f0b391..cfb69e0 100644
--- a/build2/config/init.cxx
+++ b/build2/config/init.cxx
@@ -40,6 +40,10 @@ namespace build2
auto& vp (var_pool.rw (rs));
+ // utility.cxx:unconfigured()
+ //
+ vp.insert_pattern<bool> ("config.*.configured");
+
// Load config.build if one exists.
//
// Note that we have to do this during bootstrap since the order in
diff --git a/build2/config/utility b/build2/config/utility
index e4e463d..041277a 100644
--- a/build2/config/utility
+++ b/build2/config/utility
@@ -116,21 +116,21 @@ namespace build2
// running the tests, etc).
//
bool
- specified (scope& root, const string& ns);
+ specified (scope& root, const string& name);
// Check if there is a false config.*.configured value. This mechanism can
// be used to "remember" that the module is left unconfigured in order to
// avoid re-running the tests, etc.
//
bool
- unconfigured (scope& root, const string& ns);
+ unconfigured (scope& root, const string& name);
// Set the config.*.configured value. Note that you only need to set it to
// false. It will be automatically ignored if there are any other config.*
// values for this module. Return true if this sets a new value.
//
bool
- unconfigured (scope& root, const string& ns, bool);
+ unconfigured (scope& root, const string& name, bool);
// Enter the variable so that it is saved during configuration. See
// config::module for details.
diff --git a/build2/config/utility.cxx b/build2/config/utility.cxx
index 7db4555..08faeeb 100644
--- a/build2/config/utility.cxx
+++ b/build2/config/utility.cxx
@@ -62,7 +62,7 @@ namespace build2
}
bool
- specified (scope& r, const string& ns)
+ specified (scope& r, const string& n)
{
// Search all outer scopes for any value in this namespace.
//
@@ -72,7 +72,7 @@ namespace build2
// any original values, they will be "visible"; see find_override() for
// details.
//
- const variable& vns (var_pool.rw (r).insert (ns));
+ const variable& vns (var_pool.rw (r).insert ("config." + n));
for (scope* s (&r); s != nullptr; s = s->parent_scope ())
{
for (auto p (s->vars.find_namespace (vns));
@@ -93,11 +93,12 @@ namespace build2
}
bool
- unconfigured (scope& rs, const string& ns)
+ unconfigured (scope& rs, const string& n)
{
- // Note: not overridable.
+ // Pattern-typed in boot() as bool.
//
- const variable& var (var_pool.rw (rs).insert<bool> (ns + ".configured"));
+ const variable& var (
+ var_pool.rw (rs).insert ("config." + n + ".configured"));
if (current_mif->id == configure_id)
save_variable (rs, var);
@@ -107,11 +108,12 @@ namespace build2
}
bool
- unconfigured (scope& rs, const string& ns, bool v)
+ unconfigured (scope& rs, const string& n, bool v)
{
- // Note: not overridable.
+ // Pattern-typed in boot() as bool.
//
- const variable& var (var_pool.rw (rs).insert<bool> (ns + ".configured"));
+ const variable& var (
+ var_pool.rw (rs).insert ("config." + n + ".configured"));
if (current_mif->id == configure_id)
save_variable (rs, var);