#include <attributes.h>
#include <atomic>
#include <cassert>
#include <source_location>
#include <stdexcept>
#include <string>
#include <string_view>
#include <utility>
Go to the source code of this file.
◆ ASAN_POISON_MEMORY_REGION
| #define ASAN_POISON_MEMORY_REGION |
( |
| addr, |
|
|
| size ) |
Value:((void)(addr), (void)(size))
Definition at line 140 of file check.h.
◆ ASAN_UNPOISON_MEMORY_REGION
| #define ASAN_UNPOISON_MEMORY_REGION |
( |
| addr, |
|
|
| size ) |
Value:((void)(addr), (void)(size))
Definition at line 141 of file check.h.
◆ Assert
Value:
constexpr T && inline_assertion_check(LIFETIMEBOUND T &&val, const std::source_location &loc, std::string_view assertion)
Helper for Assert()/Assume().
Identity function.
Abort if the value compares equal to zero
Definition at line 113 of file check.h.
◆ Assume
Value:
Assume is the identity function.
- Should be used to run non-fatal checks. In debug builds it behaves like Assert()/assert() to notify developers and testers about non-fatal errors. In production it doesn't warn or log anything.
- For fatal errors, use Assert().
- For non-fatal errors in interactive sessions (e.g. RPC or command line interfaces), CHECK_NONFATAL() might be more appropriate.
Definition at line 125 of file check.h.
◆ CHECK_NONFATAL
| #define CHECK_NONFATAL |
( |
| condition | ) |
|
Value:
T && inline_check_non_fatal(LIFETIMEBOUND T &&val, const std::source_location &loc, std::string_view assertion)
Helper for CHECK_NONFATAL().
Identity function.
Throw a NonFatalCheckError when the condition evaluates to false
This should only be used
- where the condition is assumed to be true, not for error handling or validating user input
- where a failure to fulfill the condition is recoverable and does not abort the program
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.
Definition at line 109 of file check.h.
◆ NONFATAL_UNREACHABLE
| #define NONFATAL_UNREACHABLE |
( |
| ) |
|
◆ STR_INTERNAL_BUG
| #define STR_INTERNAL_BUG |
( |
| msg | ) |
|
Value:
std::string StrFormatInternalBug(std::string_view msg, const std::source_location &loc)
Definition at line 96 of file check.h.
◆ assertion_fail()
| void assertion_fail |
( |
const std::source_location & | loc, |
|
|
std::string_view | assertion ) |
Internal helper.
Definition at line 34 of file check.cpp.
◆ EnableFuzzDeterminism()
| bool EnableFuzzDeterminism |
( |
| ) |
|
|
inline |
◆ inline_assertion_check()
template<bool IS_ASSERT, typename
T>
| T && inline_assertion_check |
( |
LIFETIMEBOUND T && | val, |
|
|
const std::source_location & | loc, |
|
|
std::string_view | assertion ) |
|
constexpr |
◆ inline_check_non_fatal()
| T && inline_check_non_fatal |
( |
LIFETIMEBOUND T && | val, |
|
|
const std::source_location & | loc, |
|
|
std::string_view | assertion ) |
◆ StrFormatInternalBug()
| std::string StrFormatInternalBug |
( |
std::string_view | msg, |
|
|
const std::source_location & | loc ) |
◆ G_ABORT_ON_FAILED_ASSUME
| bool G_ABORT_ON_FAILED_ASSUME |
|
constexpr |
Initial value:
false
}
constexpr bool G_FUZZING_BUILD
Definition at line 25 of file check.h.
◆ g_detail_test_only_CheckFailuresAreExceptionsNotAborts
| bool g_detail_test_only_CheckFailuresAreExceptionsNotAborts |
|
extern |
◆ g_enable_dynamic_fuzz_determinism
| std::atomic<bool> g_enable_dynamic_fuzz_determinism |
|
extern |
◆ G_FUZZING_BUILD
Initial value:
Definition at line 18 of file check.h.