From b2df0b0663d0537dd3b4f2d28d145ccd90417cab Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 18 Aug 2020 08:04:07 +0200 Subject: Add ability to mark config.* variables as "unsaved" (always transient) --- libbuild2/config/module.hxx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'libbuild2/config/module.hxx') diff --git a/libbuild2/config/module.hxx b/libbuild2/config/module.hxx index 96220ac..857a30c 100644 --- a/libbuild2/config/module.hxx +++ b/libbuild2/config/module.hxx @@ -25,12 +25,13 @@ namespace build2 // 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. + // saved in the order populated. If flags are absent, then this variable + // was marked as "unsaved" (always transient). // struct saved_variable { reference_wrapper var; - uint64_t flags; + optional flags; }; struct saved_variables: vector @@ -75,10 +76,10 @@ namespace build2 // Return true if variable/module were newly inserted. // bool - save_variable (const variable&, uint64_t flags = 0); + save_variable (const variable&, optional flags); static void - save_variable (scope&, const variable&, uint64_t); + save_variable (scope&, const variable&, optional); bool save_module (const char* name, int prio = 0); @@ -86,14 +87,18 @@ namespace build2 static void save_module (scope&, const char*, int); - // Return true if the variable is already saved. - // - bool - saved (const variable& var) + const saved_variable* + find_variable (const variable& var) { auto i (saved_modules.find_sup (var.name)); - return i != saved_modules.end () && - i->second.find (var) != i->second.end (); + if (i != saved_modules.end ()) + { + auto j (i->second.find (var)); + if (j != i->second.end ()) + return &*j; + } + + return nullptr; } // Configure/disfigure hooks. -- cgit v1.1