aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-06-03 12:23:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-03 12:23:34 +0200
commitef130e855b5ac0f4acbb8b5b6fcd14069df8afe5 (patch)
tree6bdbe9f549ccc6358ae214b6b24e1af243d019cf /libbuild2/variable.cxx
parent88b0aed33748ba4a3b3635063999cbf98a434672 (diff)
Reset value::extra on variable_map value change/version increment
The reset on each modification semantics is used to implement the default value distinction as currently done in the config module but later probably will be done for ?= and $origin().
Diffstat (limited to 'libbuild2/variable.cxx')
-rw-r--r--libbuild2/variable.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx
index 0f2a3de..74fad14 100644
--- a/libbuild2/variable.cxx
+++ b/libbuild2/variable.cxx
@@ -1761,13 +1761,16 @@ namespace build2
auto* r (const_cast<value_data*> (p.first));
if (r != nullptr)
+ {
+ r->extra = 0;
r->version++;
+ }
return pair<value_data*, const variable&> (r, p.second);
}
pair<value&, bool> variable_map::
- insert (const variable& var, bool typed)
+ insert (const variable& var, bool typed, bool reset_extra)
{
assert (!global_ || ctx->phase == run_phase::load);
@@ -1776,6 +1779,9 @@ namespace build2
if (!p.second)
{
+ if (reset_extra)
+ r.extra = 0;
+
// Check if this is the first access after being assigned a type.
//
// Note: we still need atomic in case this is not a global state.