aboutsummaryrefslogtreecommitdiff
path: root/build2/variable.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-03 13:58:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-03 13:58:28 +0200
commit721835d4dd0fe306e4b55d425f9360fac592eace (patch)
treec6358c198a444d2ce387942e17e22c8bac7f55b7 /build2/variable.cxx
parentc49b0e8ca53928cc20e9d4832536baaeee6d7a9d (diff)
Allow typification of variables and values across load generations
The original semantics turned out to be too restrictive. For example, the user may have specified the config.c variable on the command line that is only used by an imported project that is loaded in a subsequent generation. We are also relaxing it for values since conceptually the two feel the same. For a value the (hypothetical) example is a "common" variable set in a project root that is only queried in a subdirectory in a subsequent generation.
Diffstat (limited to 'build2/variable.cxx')
-rw-r--r--build2/variable.cxx26
1 files changed, 3 insertions, 23 deletions
diff --git a/build2/variable.cxx b/build2/variable.cxx
index 1afa872..8d9aa14 100644
--- a/build2/variable.cxx
+++ b/build2/variable.cxx
@@ -1016,16 +1016,6 @@ namespace build2
bool ut (t != nullptr && var.type != t);
bool uv (v != nullptr && var.visibility != *v);
- // In the global pool existing variables can only be updated during the
- // same load generation or during serial execution.
- //
- if (global_ &&
- load_generation != 0 &&
- load_generation != var.generation &&
- (ut || uv))
- fail << "variable " << var.name << " already defined with different "
- << (ut ? (uv ? "type and visibility" : "type") : "visibility");
-
// Update type?
//
if (ut)
@@ -1141,8 +1131,7 @@ namespace build2
move (n),
t,
nullptr,
- v != nullptr ? *v : variable_visibility::normal,
- global_ ? load_generation : 0}));
+ v != nullptr ? *v : variable_visibility::normal}));
variable& r (p.first->second);
@@ -1233,16 +1222,9 @@ namespace build2
// variable_map
//
- void variable_map::
+ inline void variable_map::
typify (value_data& v, const variable& var) const
{
- // In the global state existing value can only be typified during
- // the same load generation or during serial execution.
- //
- assert (!global_ ||
- load_generation == 0 ||
- v.generation == load_generation);
-
// We assume typification is not modification.
//
build2::typify (v, *var.type, &var);
@@ -1286,9 +1268,7 @@ namespace build2
auto p (m_.emplace (var, value_data (typed ? var.type : nullptr)));
value_data& r (p.first->second);
- if (p.second)
- r.generation = global_ ? load_generation : 0;
- else
+ if (!p.second)
{
// First access after being assigned a type?
//