![]() |
Bitcoin Core 28.0.0
P2P Digital Currency
|
#include <attributes.h>#include <cassert>#include <stdexcept>#include <string>#include <string_view>#include <utility>Go to the source code of this file.
Classes | |
| class | NonFatalCheckError |
Macros | |
| #define | STR_INTERNAL_BUG(msg) |
| #define | CHECK_NONFATAL(condition) |
| Identity function. | |
| #define | Assert(val) |
| Identity function. | |
| #define | Assume(val) |
| Assume is the identity function. | |
| #define | NONFATAL_UNREACHABLE() |
| NONFATAL_UNREACHABLE() is a macro that is used to mark unreachable code. | |
Functions | |
| std::string | StrFormatInternalBug (std::string_view msg, std::string_view file, int line, std::string_view func) |
| template<typename T > | |
| T && | inline_check_non_fatal (LIFETIMEBOUND T &&val, const char *file, int line, const char *func, const char *assertion) |
| Helper for CHECK_NONFATAL() | |
| void | assertion_fail (std::string_view file, int line, std::string_view func, std::string_view assertion) |
| Helper for Assert() | |
| template<bool IS_ASSERT, typename T > | |
| T && | inline_assertion_check (LIFETIMEBOUND T &&val, const char *file, int line, const char *func, const char *assertion) |
| Helper for Assert()/Assume() | |
| #define Assert | ( | val | ) |
Identity function.
Abort if the value compares equal to zero
| #define Assume | ( | val | ) |
Assume is the identity function.
| #define CHECK_NONFATAL | ( | condition | ) |
Identity function.
Throw a NonFatalCheckError when the condition evaluates to false
This should only be used
For example in RPC code, where it is undesirable to crash the whole program, this can be generally used to replace asserts or recoverable logic errors. A NonFatalCheckError in RPC code is caught and passed as a string to the RPC caller, which can then report the issue to the developers.
| #define NONFATAL_UNREACHABLE | ( | ) |
NONFATAL_UNREACHABLE() is a macro that is used to mark unreachable code.
It throws a NonFatalCheckError.
| #define STR_INTERNAL_BUG | ( | msg | ) |
| void assertion_fail | ( | std::string_view | file, |
| int | line, | ||
| std::string_view | func, | ||
| std::string_view | assertion ) |
| T && inline_assertion_check | ( | LIFETIMEBOUND T && | val, |
| const char * | file, | ||
| int | line, | ||
| const char * | func, | ||
| const char * | assertion ) |
| T && inline_check_non_fatal | ( | LIFETIMEBOUND T && | val, |
| const char * | file, | ||
| int | line, | ||
| const char * | func, | ||
| const char * | assertion ) |
Helper for CHECK_NONFATAL()