aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/config/utility.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-08-18 08:04:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-08-18 08:04:07 +0200
commitb2df0b0663d0537dd3b4f2d28d145ccd90417cab (patch)
treeb58ff44bfa5a8423721d6b865541a2e3a3d27d60 /libbuild2/config/utility.hxx
parent5521a0edd9a2ba8429f7d2e48f754c9d6f66cc3b (diff)
Add ability to mark config.* variables as "unsaved" (always transient)
Diffstat (limited to 'libbuild2/config/utility.hxx')
-rw-r--r--libbuild2/config/utility.hxx14
1 files changed, 13 insertions, 1 deletions
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<uint64_t>);
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.
//