mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
util/check: Add CHECK_NONFATAL identity function, NONFATAL_UNREACHABLE AND UNREACHABLE macros
This commit is contained in:
parent
e0680bbce8
commit
ee02c8bd9a
7 changed files with 49 additions and 39 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include <script/descriptor.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/check.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/string.h>
|
||||
#include <util/translation.h>
|
||||
|
|
@ -542,7 +543,7 @@ RPCHelpMan::RPCHelpMan(std::string name, std::string description, std::vector<RP
|
|||
// Null values are accepted in all arguments
|
||||
break;
|
||||
default:
|
||||
CHECK_NONFATAL(false);
|
||||
NONFATAL_UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -793,7 +794,7 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
|
|||
return;
|
||||
}
|
||||
case Type::ANY: {
|
||||
CHECK_NONFATAL(false); // Only for testing
|
||||
NONFATAL_UNREACHABLE(); // Only for testing
|
||||
}
|
||||
case Type::NONE: {
|
||||
sections.PushSection({indent + "null" + maybe_separator, Description("json null")});
|
||||
|
|
@ -860,7 +861,7 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
|
|||
return;
|
||||
}
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
CHECK_NONFATAL(false);
|
||||
NONFATAL_UNREACHABLE();
|
||||
}
|
||||
|
||||
bool RPCResult::MatchesType(const UniValue& result) const
|
||||
|
|
@ -938,7 +939,7 @@ bool RPCResult::MatchesType(const UniValue& result) const
|
|||
return true;
|
||||
}
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
CHECK_NONFATAL(false);
|
||||
NONFATAL_UNREACHABLE();
|
||||
}
|
||||
|
||||
void RPCResult::CheckInnerDoc() const
|
||||
|
|
@ -984,9 +985,9 @@ std::string RPCArg::ToStringObj(const bool oneline) const
|
|||
case Type::OBJ:
|
||||
case Type::OBJ_USER_KEYS:
|
||||
// Currently unused, so avoid writing dead code
|
||||
CHECK_NONFATAL(false);
|
||||
NONFATAL_UNREACHABLE();
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
CHECK_NONFATAL(false);
|
||||
NONFATAL_UNREACHABLE();
|
||||
}
|
||||
|
||||
std::string RPCArg::ToString(const bool oneline) const
|
||||
|
|
@ -1021,7 +1022,7 @@ std::string RPCArg::ToString(const bool oneline) const
|
|||
return "[" + res + "...]";
|
||||
}
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
CHECK_NONFATAL(false);
|
||||
NONFATAL_UNREACHABLE();
|
||||
}
|
||||
|
||||
static std::pair<int64_t, int64_t> ParseRange(const UniValue& value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue