From bb18938b809637a37df53aabc28937f1bf7b00c7 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 23 Jun 2022 13:17:56 +0200 Subject: 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. --- src/buildtool/common/action_description.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/buildtool/common/action_description.hpp') 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()) { -- cgit v1.2.3