diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-07-04 19:12:15 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-07-05 14:24:43 +0300 |
commit | 57b10c06925d0bdf6ffb38488ee908f085109e95 (patch) | |
tree | f2103684d319650c3302aef9d7a70dd64ff2a347 /build2/config/utility.txx | |
parent | 30b4eda196e090aa820d312e6a9435a4ae84c303 (diff) |
Move config, dist, test, and install modules into library
Diffstat (limited to 'build2/config/utility.txx')
-rw-r--r-- | build2/config/utility.txx | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/build2/config/utility.txx b/build2/config/utility.txx deleted file mode 100644 index 84650d9..0000000 --- a/build2/config/utility.txx +++ /dev/null @@ -1,66 +0,0 @@ -// file : build2/config/utility.txx -*- C++ -*- -// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include <libbuild2/scope.hxx> -#include <libbuild2/context.hxx> - -namespace build2 -{ - namespace config - { - template <typename T> - pair<lookup, bool> - required (scope& root, - const variable& var, - const T& def_val, - bool def_ovr, - uint64_t save_flags) - { - // Note: see also omitted() if changing anything here. - - if (current_mif->id == configure_id) - save_variable (root, var, save_flags); - - pair<lookup, size_t> org (root.find_original (var)); - - bool n (false); // New flag. - lookup l (org.first); - - // The interaction with command line overrides can get tricky. For - // example, the override to defaul value could make (non-recursive) - // command line override in the outer scope no longer apply. So what we - // are going to do is first ignore overrides and perform the normal - // logic on the original. Then we apply the overrides on the result. - // - if (!l.defined () || (def_ovr && !l.belongs (root))) - { - value& v (root.assign (var) = def_val); - v.extra = true; // Default value flag. - - n = (save_flags & save_commented) == 0; // Absence means default. - l = lookup (v, var, 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 = (save_flags & save_commented) == 0; // Absence means default. - - if (var.overrides != nullptr) - { - pair<lookup, size_t> ovr (root.find_override (var, move (org))); - - if (l != ovr.first) // Overriden? - { - // Override is always treated as new. - // - n = true; - l = move (ovr.first); - } - } - - return pair<lookup, bool> (l, n); - } - } -} |