From 4b4d7a0fd5c21815f4902d6527cb1eaf13b233f7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 3 Aug 2016 10:37:12 +0200 Subject: Don't treat absent config values that are saved commented as new --- build2/config/utility | 6 +++++- build2/config/utility.txx | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'build2/config') 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 pair, 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) { -- cgit v1.1