diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-03 10:37:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-03 10:37:12 +0200 |
commit | 4b4d7a0fd5c21815f4902d6527cb1eaf13b233f7 (patch) | |
tree | 02b5499176c3c74fa928a3e0ae4ea05111366726 | |
parent | adc5b6e9bbd6de2977f2b0686b95c6344cc39141 (diff) |
Don't treat absent config values that are saved commented as new
-rw-r--r-- | build2/config/utility | 6 | ||||
-rw-r--r-- | build2/config/utility.txx | 4 |
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) { |