summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-06-23 13:17:56 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-06-24 13:35:25 +0200
commitbb18938b809637a37df53aabc28937f1bf7b00c7 (patch)
tree2504722189825c7036da07611aff65f1b7dc2b12 /src
parentc322048c9b5469cd09bf51a99f6eea26e4beedfa (diff)
downloadjustbuild-bb18938b809637a37df53aabc28937f1bf7b00c7.tar.gz
action deserialisation: accept null for "may_fail"
In that way, we are consistent with all other values in that there is a way to positively state that the default value should be taken. While there, fix a wrong error message.
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/common/action_description.hpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/buildtool/common/action_description.hpp b/src/buildtool/common/action_description.hpp
index f830eb82..845ea5a5 100644
--- a/src/buildtool/common/action_description.hpp
+++ b/src/buildtool/common/action_description.hpp
@@ -98,12 +98,17 @@ class ActionDescription {
bool no_cache{};
auto may_fail_it = desc.find("may_fail");
if (may_fail_it != desc.end()) {
- if (not may_fail_it->is_string()) {
+ if (may_fail_it->is_null()) {
+ may_fail = std::nullopt;
+ }
+ else if (may_fail_it->is_string()) {
+ may_fail = *may_fail_it;
+ }
+ else {
Logger::Log(LogLevel::Error,
- "may_fail has to be a boolean");
+ "may_fail has to be a null or a string");
return std::nullopt;
}
- may_fail = *may_fail_it;
}
auto no_cache_it = desc.find("no_cache");
if (no_cache_it != desc.end()) {