From ef130e855b5ac0f4acbb8b5b6fcd14069df8afe5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 3 Jun 2022 12:23:34 +0200 Subject: 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(). --- libbuild2/variable.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libbuild2/variable.cxx') 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 (p.first)); if (r != nullptr) + { + r->extra = 0; r->version++; + } return pair (r, p.second); } pair 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. -- cgit v1.1