aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-03-16 16:02:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-03-16 16:02:06 +0200
commitc76ff457079bf5901a6bb55377c14aeee856a354 (patch)
tree6a7d0c7606370b54fa77369dd101d035aad08918
parent20677fb264e743b8e5423af31a7d8dc06cf509f6 (diff)
Cleanup variable typing
-rw-r--r--build2/bin/module.cxx32
-rw-r--r--build2/cli/module.cxx8
-rw-r--r--build2/context.cxx16
-rw-r--r--build2/cxx/module.cxx28
-rw-r--r--build2/dist/module.cxx16
-rw-r--r--build2/install/module.cxx8
-rw-r--r--build2/test/module.cxx12
-rw-r--r--build2/test/rule.cxx10
-rw-r--r--build2/variable7
9 files changed, 71 insertions, 66 deletions
diff --git a/build2/bin/module.cxx b/build2/bin/module.cxx
index eb4d771..702e762 100644
--- a/build2/bin/module.cxx
+++ b/build2/bin/module.cxx
@@ -47,22 +47,22 @@ namespace build2
{
auto& v (var_pool);
- v.find ("config.bin.ar", string_type); //@@ VAR path_type
- v.find ("config.bin.ranlib", string_type); //@@ VAR path_type
-
- v.find ("config.bin.lib", string_type);
- v.find ("config.bin.exe.lib", strings_type);
- v.find ("config.bin.liba.lib", strings_type);
- v.find ("config.bin.libso.lib", strings_type);
- v.find ("config.bin.rpath", strings_type); //@@ VAR paths_type
-
- v.find ("bin.lib", string_type);
- v.find ("bin.exe.lib", strings_type);
- v.find ("bin.liba.lib", strings_type);
- v.find ("bin.libso.lib", strings_type);
- v.find ("bin.rpath", strings_type); //@@ VAR paths_type
-
- v.find ("bin.libprefix", string_type);
+ v.find<string> ("config.bin.ar"); //@@ VAR path_type
+ v.find<string> ("config.bin.ranlib"); //@@ VAR path_type
+
+ v.find<string> ("config.bin.lib");
+ v.find<strings> ("config.bin.exe.lib");
+ v.find<strings> ("config.bin.liba.lib");
+ v.find<strings> ("config.bin.libso.lib");
+ v.find<strings> ("config.bin.rpath"); //@@ VAR paths_type
+
+ v.find<string> ("bin.lib");
+ v.find<strings> ("bin.exe.lib");
+ v.find<strings> ("bin.liba.lib");
+ v.find<strings> ("bin.libso.lib");
+ v.find<strings> ("bin.rpath"); //@@ VAR paths_type
+
+ v.find<string> ("bin.libprefix");
}
// Register target types.
diff --git a/build2/cli/module.cxx b/build2/cli/module.cxx
index 8ec2db9..6497766 100644
--- a/build2/cli/module.cxx
+++ b/build2/cli/module.cxx
@@ -55,12 +55,12 @@ namespace build2
{
auto& v (var_pool);
- v.find ("config.cli.configured", bool_type);
+ v.find<bool> ("config.cli.configured");
- v.find ("config.cli", string_type); //@@ VAR type
+ v.find<string> ("config.cli"); //@@ VAR type
- v.find ("config.cli.options", strings_type);
- v.find ("cli.options", strings_type);
+ v.find<strings> ("config.cli.options");
+ v.find<strings> ("cli.options");
}
// Register target types.
diff --git a/build2/context.cxx b/build2/context.cxx
index 49edc1c..dc84e63 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -63,19 +63,19 @@ namespace build2
{
auto& v (var_pool);
- v.find ("src_root", dir_path_type);
- v.find ("out_root", dir_path_type);
- v.find ("src_base", dir_path_type);
- v.find ("out_base", dir_path_type);
+ v.find<dir_path> ("src_root");
+ v.find<dir_path> ("out_root");
+ v.find<dir_path> ("src_base");
+ v.find<dir_path> ("out_base");
- v.find ("project", string_type);
- v.find ("amalgamation", dir_path_type);
+ v.find<string> ("project");
+ v.find<dir_path> ("amalgamation");
- // Shouldn't be typed since the value requires pre-processing.
+ // Not typed since the value requires pre-processing.
//
v.find ("subprojects", nullptr, '=');
- v.find ("extension", string_type);
+ v.find<string> ("extension");
}
// Create global scope. For Win32 this is not a "real" root path.
diff --git a/build2/cxx/module.cxx b/build2/cxx/module.cxx
index 9baccae..7c6a4dd 100644
--- a/build2/cxx/module.cxx
+++ b/build2/cxx/module.cxx
@@ -62,24 +62,24 @@ namespace build2
{
auto& v (var_pool);
- v.find ("config.cxx", string_type); //@@ VAR type
+ v.find<string> ("config.cxx"); //@@ VAR type
- v.find ("config.cxx.poptions", strings_type);
- v.find ("config.cxx.coptions", strings_type);
- v.find ("config.cxx.loptions", strings_type);
- v.find ("config.cxx.libs", strings_type);
+ v.find<strings> ("config.cxx.poptions");
+ v.find<strings> ("config.cxx.coptions");
+ v.find<strings> ("config.cxx.loptions");
+ v.find<strings> ("config.cxx.libs");
- v.find ("cxx.poptions", strings_type);
- v.find ("cxx.coptions", strings_type);
- v.find ("cxx.loptions", strings_type);
- v.find ("cxx.libs", strings_type);
+ v.find<strings> ("cxx.poptions");
+ v.find<strings> ("cxx.coptions");
+ v.find<strings> ("cxx.loptions");
+ v.find<strings> ("cxx.libs");
- v.find ("cxx.export.poptions", strings_type);
- v.find ("cxx.export.coptions", strings_type);
- v.find ("cxx.export.loptions", strings_type);
- v.find ("cxx.export.libs", strings_type);
+ v.find<strings> ("cxx.export.poptions");
+ v.find<strings> ("cxx.export.coptions");
+ v.find<strings> ("cxx.export.loptions");
+ v.find<strings> ("cxx.export.libs");
- v.find ("cxx.std", string_type);
+ v.find<string> ("cxx.std");
}
// Register target types.
diff --git a/build2/dist/module.cxx b/build2/dist/module.cxx
index a205a72..6f40b33 100644
--- a/build2/dist/module.cxx
+++ b/build2/dist/module.cxx
@@ -39,20 +39,20 @@ namespace build2
{
auto& v (var_pool);
- v.find ("dist", bool_type);
+ v.find<bool> ("dist");
- v.find ("dist.package", string_type);
+ v.find<string> ("dist.package");
- v.find ("dist.root", dir_path_type);
- v.find ("config.dist.root", dir_path_type);
+ v.find<dir_path> ("dist.root");
+ v.find<dir_path> ("config.dist.root");
//@@ VAR type
//
- v.find ("dist.cmd", string_type);
- v.find ("config.dist.cmd", string_type);
+ v.find<string> ("dist.cmd");
+ v.find<string> ("config.dist.cmd");
- v.find ("dist.archives", strings_type);
- v.find ("config.dist.archives", strings_type);
+ v.find<strings> ("dist.archives");
+ v.find<strings> ("config.dist.archives");
}
}
diff --git a/build2/install/module.cxx b/build2/install/module.cxx
index 754fcb5..579d454 100644
--- a/build2/install/module.cxx
+++ b/build2/install/module.cxx
@@ -50,8 +50,7 @@ namespace build2
vn = "config.install.";
vn += name;
vn += var;
- const variable& vr (
- var_pool.find (move (vn), &value_traits<T>::value_type));
+ const variable& vr (var_pool.find<T> (move (vn)));
cv = dv != nullptr
? &config::required (r, vr, *dv, override).first.get ()
@@ -61,8 +60,7 @@ namespace build2
vn = "install.";
vn += name;
vn += var;
- const variable& vr (
- var_pool.find (move (vn), &value_traits<T>::value_type));
+ const variable& vr (var_pool.find<T> (move (vn)));
value& v (r.assign (vr));
@@ -139,7 +137,7 @@ namespace build2
{
auto& v (var_pool);
- v.find ("install", dir_path_type);
+ v.find<dir_path> ("install");
}
// Register our alias and file installer rule.
diff --git a/build2/test/module.cxx b/build2/test/module.cxx
index c8c0fa7..10948ab 100644
--- a/build2/test/module.cxx
+++ b/build2/test/module.cxx
@@ -38,12 +38,12 @@ namespace build2
{
auto& v (var_pool);
- v.find ("test", bool_type);
- v.find ("test.input", name_type);
- v.find ("test.output", name_type);
- v.find ("test.roundtrip", name_type);
- v.find ("test.options", strings_type);
- v.find ("test.arguments", strings_type);
+ v.find<bool> ("test");
+ v.find<name> ("test.input");
+ v.find<name> ("test.output");
+ v.find<name> ("test.roundtrip");
+ v.find<strings> ("test.options");
+ v.find<strings> ("test.arguments");
}
}
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 39b7d01..efe265b 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -68,7 +68,7 @@ namespace build2
//
if (!l.defined ())
l = t.base_scope ()[
- var_pool.find (string("test.") + t.type ().name, bool_type)];
+ var_pool.find<bool> (string("test.") + t.type ().name)];
r = l && as<bool> (*l);
}
@@ -146,9 +146,9 @@ namespace build2
string n ("test.");
n += t.type ().name;
- const variable& in (var_pool.find (n + ".input", name_type));
- const variable& on (var_pool.find (n + ".output", name_type));
- const variable& rn (var_pool.find (n + ".roundtrip", name_type));
+ const variable& in (var_pool.find<name> (n + ".input"));
+ const variable& on (var_pool.find<name> (n + ".output"));
+ const variable& rn (var_pool.find<name> (n + ".roundtrip"));
// We should only keep value(s) that were specified together
// in the innermost scope.
@@ -292,7 +292,7 @@ namespace build2
var += t.type ().name;
var += '.';
var += n;
- l = t.base_scope ()[var_pool.find (var, strings_type)];
+ l = t.base_scope ()[var_pool.find<strings> (var)];
}
if (l)
diff --git a/build2/variable b/build2/variable
index 1a52566..579339e 100644
--- a/build2/variable
+++ b/build2/variable
@@ -630,6 +630,13 @@ namespace build2
using variable_pool_base = std::unordered_set<variable>;
struct variable_pool: private variable_pool_base
{
+ template <typename T>
+ const variable&
+ find (string name, char p = '\0')
+ {
+ return find (name, nullptr, &value_traits<T>::value_type, p);
+ }
+
const variable&
find (string name, const build2::value_type* t = nullptr, char p = '\0')
{