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/utility.hxx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'libbuild2/config/utility.hxx') diff --git a/libbuild2/config/utility.hxx b/libbuild2/config/utility.hxx index 209ef5c..7d3e18b 100644 --- a/libbuild2/config/utility.hxx +++ b/libbuild2/config/utility.hxx @@ -33,7 +33,7 @@ namespace build2 // attribute). Such flags should start from 0x100000000. // LIBBUILD2_SYMEXPORT extern void - (*config_save_variable) (scope&, const variable&, uint64_t); + (*config_save_variable) (scope&, const variable&, optional); LIBBUILD2_SYMEXPORT extern void (*config_save_module) (scope&, const char*, int); @@ -65,6 +65,18 @@ namespace build2 config_save_variable (rs, var, flags); } + // Mark the variable as "unsaved" (always transient). + // + // Such variables are not very common and are usually used to control the + // process of configuration itself. + // + inline void + unsave_variable (scope& rs, const variable& var) + { + if (config_save_variable != nullptr) + config_save_variable (rs, var, nullopt); + } + // Establish module save order/priority with INT32_MIN being the highest. // Modules with the same priority are saved in the order inserted. // -- cgit v1.1