diff options
Diffstat (limited to 'libbuild2')
-rw-r--r-- | libbuild2/config/operation.cxx | 4 | ||||
-rw-r--r-- | libbuild2/config/utility.cxx | 4 | ||||
-rw-r--r-- | libbuild2/config/utility.hxx | 5 | ||||
-rw-r--r-- | libbuild2/config/utility.txx | 2 |
4 files changed, 10 insertions, 5 deletions
diff --git a/libbuild2/config/operation.cxx b/libbuild2/config/operation.cxx index ed98f90..5edb610 100644 --- a/libbuild2/config/operation.cxx +++ b/libbuild2/config/operation.cxx @@ -509,8 +509,8 @@ namespace build2 // Handle the save_default_commented flag. // - if ((org.first.defined () && org.first->extra) && // Default value. - org.first == ovr.first && // Not overriden. + if (org.first.defined () && org.first->extra == 1 && // Default. + org.first == ovr.first && // No override. (flags & save_default_commented) != 0) { os << first () << '#' << n << " =" << endl; diff --git a/libbuild2/config/utility.cxx b/libbuild2/config/utility.cxx index a64d4d5..2ce94ff 100644 --- a/libbuild2/config/utility.cxx +++ b/libbuild2/config/utility.cxx @@ -32,7 +32,7 @@ namespace build2 // Treat an inherited value that was set to default as new. // - if (l.defined () && l->extra) + if (l.defined () && l->extra == 1) n = true; if (var.overrides != nullptr) @@ -200,7 +200,7 @@ namespace build2 if (org.first != ovr.first) return make_pair (variable_origin::override_, ovr.first); - return make_pair (org.first->extra + return make_pair (org.first->extra == 1 ? variable_origin::default_ : variable_origin::buildfile, org.first); diff --git a/libbuild2/config/utility.hxx b/libbuild2/config/utility.hxx index 1e33568..72fe520 100644 --- a/libbuild2/config/utility.hxx +++ b/libbuild2/config/utility.hxx @@ -64,6 +64,11 @@ namespace build2 // omitted value(s) is the default (see a note in lookup_config() // documentation for details). // + // The below lookup_*() functions mark the default value by setting + // value::extra to 1. Note that it's exactly 1 and not "not 0" since other + // values could have other meaning (see, for example, package skeleton + // in bpkg). + // const uint64_t save_default_commented = 0x01; // Based on value::extra. const uint64_t save_null_omitted = 0x02; // Treat NULL as undefined. const uint64_t save_empty_omitted = 0x04; // Treat empty as undefined. diff --git a/libbuild2/config/utility.txx b/libbuild2/config/utility.txx index 0362d6a..71e41fd 100644 --- a/libbuild2/config/utility.txx +++ b/libbuild2/config/utility.txx @@ -66,7 +66,7 @@ namespace build2 } // Treat an inherited value that was set to default as new. // - else if (l->extra) + else if (l->extra == 1) n = (sflags & save_default_commented) == 0; // Absence means default. if (var.overrides != nullptr) |