From c1d08dbc56d0c8d3346deaba5d6b1946b6d711f4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Jul 2016 15:39:52 +0200 Subject: Save config vars in order specified rather than alphabetically This way we can group them semantically which results in easier to understand config.build output. --- build2/config/module | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'build2/config/module') diff --git a/build2/config/module b/build2/config/module index aed85a5..5becfd4 100644 --- a/build2/config/module +++ b/build2/config/module @@ -17,15 +17,39 @@ namespace build2 { namespace config { - struct module: module_base + // An ordered list of modules each with an ordered list of list of + // config.* variables and their "save flags" (see save_variable()) that + // are used (as opposed to just being specified) in this configuration. + // Populated by the config utility functions (required(), optional()) + // and saved in the order populated. + // + struct saved_variable + { + reference_wrapper var; + uint64_t flags; + }; + + using saved_variables = vector; + + struct saved_modules: butl::prefix_map { - // A sorted list of config.* variables and their "save flags" (see - // save_variable()) that are used (as opposed to just being specified) - // in this configuration. Populated by the config utility functions - // (required(), optional()) - // - butl::prefix_map vars; + vector sequence; + + iterator + insert (string name) + { + auto p (emplace (move (name), saved_variables ())); + if (p.second) + sequence.push_back (p.first); + + return p.first; + } + }; + + struct module: module_base + { + config::saved_modules saved_modules; static const string name; }; -- cgit v1.1