aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/config/utility6
-rw-r--r--build2/config/utility.txx4
2 files changed, 7 insertions, 3 deletions
diff --git a/build2/config/utility b/build2/config/utility
index c1ccc0f..2be2842 100644
--- a/build2/config/utility
+++ b/build2/config/utility
@@ -28,7 +28,11 @@ namespace build2
// the value is "new", that is, it was set to the default value (inherited
// or not, including overrides). We also treat command line overrides
// (inherited or not) as new. This flag is usually used to test that the
- // new value is valid, etc.
+ // new value is valid, print report, etc.
+ //
+ // Note also that if save_flags has save_commented, then a default value
+ // is never considered "new" since for such variables absence of a value
+ // means the default value.
//
template <typename T>
pair<reference_wrapper<const value>, bool>
diff --git a/build2/config/utility.txx b/build2/config/utility.txx
index 4e6747b..ce9e40f 100644
--- a/build2/config/utility.txx
+++ b/build2/config/utility.txx
@@ -39,14 +39,14 @@ namespace build2
value& v (root.assign (var) = def_val);
v.extra = true; // Default value flag.
- n = true;
+ n = (save_flags & save_commented) == 0; // Absence means default.
l = lookup (v, root);
org = make_pair (l, 1); // Lookup depth is 1 since it's in root.vars.
}
// Treat an inherited value that was set to default as new.
//
else if (l->extra)
- n = true;
+ n = (save_flags & save_commented) == 0; // Absence means default.
if (var.override != nullptr)
{