fuzz coverage

Coverage Report

Created: 2025-09-17 22:41

/Users/eugenesiegel/btc/bitcoin/src/util/check.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) 2019-2022 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_UTIL_CHECK_H
6
#define BITCOIN_UTIL_CHECK_H
7
8
#include <attributes.h>
9
10
#include <atomic>
11
#include <cassert> // IWYU pragma: export
12
#include <stdexcept>
13
#include <string>
14
#include <string_view>
15
#include <utility>
16
17
constexpr bool G_FUZZING_BUILD{
18
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
19
    true
20
#else
21
    false
22
#endif
23
};
24
constexpr bool G_ABORT_ON_FAILED_ASSUME{
25
#ifdef ABORT_ON_FAILED_ASSUME
26
    true
27
#else
28
    false
29
#endif
30
};
31
32
extern std::atomic<bool> g_enable_dynamic_fuzz_determinism;
33
34
inline bool EnableFuzzDeterminism()
35
14.6M
{
36
14.6M
    if constexpr (G_FUZZING_BUILD) {
37
14.6M
        return true;
38
    } else if constexpr (!G_ABORT_ON_FAILED_ASSUME) {
39
        // Running fuzz tests is always disabled if Assume() doesn't abort
40
        // (ie, non-fuzz non-debug builds), as otherwise tests which
41
        // should fail due to a failing Assume may still pass. As such,
42
        // we also statically disable fuzz determinism in that case.
43
        return false;
44
    } else {
45
        return g_enable_dynamic_fuzz_determinism;
46
    }
47
14.6M
}
48
49
std::string StrFormatInternalBug(std::string_view msg, std::string_view file, int line, std::string_view func);
50
51
class NonFatalCheckError : public std::runtime_error
52
{
53
public:
54
    NonFatalCheckError(std::string_view msg, std::string_view file, int line, std::string_view func);
55
};
56
57
/** Helper for CHECK_NONFATAL() */
58
template <typename T>
59
T&& inline_check_non_fatal(LIFETIMEBOUND T&& val, const char* file, int line, const char* func, const char* assertion)
60
4.04M
{
61
4.04M
    if (!val) {
62
0
        throw NonFatalCheckError{assertion, file, line, func};
63
0
    }
64
4.04M
    return std::forward<T>(val);
65
4.04M
}
_Z22inline_check_non_fatalIbEOT_S1_PKciS3_S3_
Line
Count
Source
60
4.04M
{
61
4.04M
    if (!val) {
62
0
        throw NonFatalCheckError{assertion, file, line, func};
63
0
    }
64
4.04M
    return std::forward<T>(val);
65
4.04M
}
Unexecuted instantiation: _Z22inline_check_non_fatalIRKbEOT_S3_PKciS5_S5_
Unexecuted instantiation: _Z22inline_check_non_fatalIRbEOT_S2_PKciS4_S4_
Unexecuted instantiation: _Z22inline_check_non_fatalIRPK14JSONRPCRequestEOT_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_check_non_fatalIRPK8UniValueEOT_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_check_non_fatalINSt3__18optionalI13arith_uint256EEEOT_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_check_non_fatalIRPN6wallet25DescriptorScriptPubKeyManEEOT_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_check_non_fatalINSt3__110unique_ptrI16CCoinsViewCursorNS0_14default_deleteIS2_EEEEEOT_S7_PKciS9_S9_
Unexecuted instantiation: _Z22inline_check_non_fatalIRPK11CBlockIndexEOT_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_check_non_fatalIPN4node12BlockManagerEEOT_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_check_non_fatalINSt3__110shared_ptrIK12CTransactionEEEOT_S6_PKciS8_S8_
Unexecuted instantiation: _Z22inline_check_non_fatalIRP11CBlockIndexEOT_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_check_non_fatalINSt3__18optionalIN10interfaces8BlockRefEEEEOT_S6_PKciS8_S8_
Unexecuted instantiation: _Z22inline_check_non_fatalIRNSt3__110unique_ptrI17ValidationSignalsNS0_14default_deleteIS2_EEEEEOT_S8_PKciSA_SA_
Unexecuted instantiation: _Z22inline_check_non_fatalIP11CBlockIndexEOT_S3_PKciS5_S5_
Unexecuted instantiation: _Z22inline_check_non_fatalIPK11CBlockIndexEOT_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_check_non_fatalIRKP11CBlockIndexEOT_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_check_non_fatalIRNSt3__110unique_ptrIN4node8WarningsENS0_14default_deleteIS3_EEEEEOT_S9_PKciSB_SB_
Unexecuted instantiation: _Z22inline_check_non_fatalIRNSt3__18optionalIN6kernel11CCoinsStatsEEEEOT_S7_PKciS9_S9_
Unexecuted instantiation: _Z22inline_check_non_fatalIRKP17ValidationSignalsEOT_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_check_non_fatalIRKNSt3__110unique_ptrI17ValidationSignalsNS0_14default_deleteIS2_EEEEEOT_S9_PKciSB_SB_
Unexecuted instantiation: _Z22inline_check_non_fatalIRNSt3__110unique_ptrIN10interfaces13BlockTemplateENS0_14default_deleteIS3_EEEEEOT_S9_PKciSB_SB_
Unexecuted instantiation: _Z22inline_check_non_fatalIRKNSt3__110unique_ptrI10CSchedulerNS0_14default_deleteIS2_EEEEEOT_S9_PKciSB_SB_
Unexecuted instantiation: _Z22inline_check_non_fatalIRNSt3__18functionIFbvEEEEOT_S6_PKciS8_S8_
66
67
#if defined(NDEBUG)
68
#error "Cannot compile without assertions!"
69
#endif
70
71
/** Helper for Assert() */
72
void assertion_fail(std::string_view file, int line, std::string_view func, std::string_view assertion);
73
74
/** Helper for Assert()/Assume() */
75
template <bool IS_ASSERT, typename T>
76
constexpr T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* file, [[maybe_unused]] int line, [[maybe_unused]] const char* func, [[maybe_unused]] const char* assertion)
77
92.2M
{
78
92.2M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
92.2M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
92.2M
    }
83
92.2M
    return std::forward<T>(val);
84
92.2M
}
_Z22inline_assertion_checkILb0EbEOT0_S1_PKciS3_S3_
Line
Count
Source
77
39.7M
{
78
39.7M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
39.7M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
39.7M
    }
83
39.7M
    return std::forward<T>(val);
84
39.7M
}
_Z22inline_assertion_checkILb0EiEOT0_S1_PKciS3_S3_
Line
Count
Source
77
6.66M
{
78
6.66M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
6.66M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
6.66M
    }
83
6.66M
    return std::forward<T>(val);
84
6.66M
}
_Z22inline_assertion_checkILb0ERKhEOT0_S3_PKciS5_S5_
Line
Count
Source
77
137k
{
78
137k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
137k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
137k
    }
83
137k
    return std::forward<T>(val);
84
137k
}
_Z22inline_assertion_checkILb1ERKNSt3__110unique_ptrI14LevelDBContextNS0_14default_deleteIS2_EEEEEOT0_S9_PKciSB_SB_
Line
Count
Source
77
5.35M
{
78
5.35M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
5.35M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
5.35M
    }
83
5.35M
    return std::forward<T>(val);
84
5.35M
}
_Z22inline_assertion_checkILb1ERNSt3__110unique_ptrI10CoinsViewsNS0_14default_deleteIS2_EEEEEOT0_S8_PKciSA_SA_
Line
Count
Source
77
5.28M
{
78
5.28M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
5.28M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
5.28M
    }
83
5.28M
    return std::forward<T>(val);
84
5.28M
}
_Z22inline_assertion_checkILb1ERNSt3__110unique_ptrI15CCoinsViewCacheNS0_14default_deleteIS2_EEEEEOT0_S8_PKciSA_SA_
Line
Count
Source
77
5.16M
{
78
5.16M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
5.16M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
5.16M
    }
83
5.16M
    return std::forward<T>(val);
84
5.16M
}
_Z22inline_assertion_checkILb1ERKNSt3__18optionalI13arith_uint256EEEOT0_S7_PKciS9_S9_
Line
Count
Source
77
7.88M
{
78
7.88M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
7.88M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
7.88M
    }
83
7.88M
    return std::forward<T>(val);
84
7.88M
}
_Z22inline_assertion_checkILb1ERKNSt3__18optionalI7uint256EEEOT0_S7_PKciS9_S9_
Line
Count
Source
77
232k
{
78
232k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
232k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
232k
    }
83
232k
    return std::forward<T>(val);
84
232k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERmEOT0_S2_PKciS4_S4_
Unexecuted instantiation: _Z22inline_assertion_checkILb1E10MinisketchEOT0_S2_PKciS4_S4_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ENSt3__18optionalINS0_6vectorIyNS0_9allocatorIyEEEEEEEOT0_S8_PKciSA_SA_
_Z22inline_assertion_checkILb1EbEOT0_S1_PKciS3_S3_
Line
Count
Source
77
9.39M
{
78
9.39M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
9.39M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
9.39M
    }
83
9.39M
    return std::forward<T>(val);
84
9.39M
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERbEOT0_S2_PKciS4_S4_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPK13MappingResultEOT0_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_assertion_checkILb1EPK15CTxMemPoolEntryEOT0_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ElEOT0_S1_PKciS3_S3_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKbEOT0_S3_PKciS5_S5_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKNSt3__18optionalIxEEEOT0_S6_PKciS8_S8_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKNSt3__18optionalI8CFeeRateEEEOT0_S7_PKciS9_S9_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKNSt3__18optionalINS0_6vectorI22transaction_identifierILb1EENS0_9allocatorIS4_EEEEEEEOT0_SC_PKciSE_SE_
_Z22inline_assertion_checkILb1ERPK11CBlockIndexEOT0_S5_PKciS7_S7_
Line
Count
Source
77
1.27M
{
78
1.27M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
1.27M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
1.27M
    }
83
1.27M
    return std::forward<T>(val);
84
1.27M
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1ENSt3__18optionalIN6kernel11CCoinsStatsEEEEOT0_S6_PKciS8_S8_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ENSt3__18optionalI14AssumeutxoDataEEEOT0_S5_PKciS7_S7_
_Z22inline_assertion_checkILb1ERNSt3__110unique_ptrI17ChainstateManagerNS0_14default_deleteIS2_EEEEEOT0_S8_PKciSA_SA_
Line
Count
Source
77
38.8k
{
78
38.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
38.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
38.8k
    }
83
38.8k
    return std::forward<T>(val);
84
38.8k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERKmEOT0_S3_PKciS5_S5_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ENSt3__18optionalIiEEEOT0_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_assertion_checkILb1EN4util6ResultINSt3__117reference_wrapperIN6wallet25DescriptorScriptPubKeyManEEEEEEOT0_S9_PKciSB_SB_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ENSt3__18optionalI10OutputTypeEEEOT0_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_assertion_checkILb1EN4util6ResultINSt3__17variantIJ14CNoDestination17PubKeyDestination6PKHash10ScriptHash19WitnessV0ScriptHash16WitnessV0KeyHash16WitnessV1Taproot11PayToAnchor14WitnessUnknownEEEEEEOT0_SG_PKciSI_SI_
_Z22inline_assertion_checkILb1ERPKNSt3__18functionIFvNS0_4spanIKhLm18446744073709551615EEEEEEEOT0_SB_PKciSD_SD_
Line
Count
Source
77
38.8k
{
78
38.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
38.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
38.8k
    }
83
38.8k
    return std::forward<T>(val);
84
38.8k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKNSt3__18optionalIN2fs4pathEEEEOT0_S8_PKciSA_SA_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERNSt3__18optionalI19CMutableTransactionEEEOT0_S6_PKciS8_S8_
_Z22inline_assertion_checkILb0ERKbEOT0_S3_PKciS5_S5_
Line
Count
Source
77
459k
{
78
459k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
459k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
459k
    }
83
459k
    return std::forward<T>(val);
84
459k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERP10CSchedulerEOT0_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERP11ArgsManagerEOT0_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_assertion_checkILb1EPKN6wallet9CWalletTxEEOT0_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERNSt3__110unique_ptrIN6wallet17SQliteExecHandlerENS0_14default_deleteIS3_EEEEEOT0_S9_PKciSB_SB_
Unexecuted instantiation: _Z22inline_assertion_checkILb1EyEOT0_S1_PKciS3_S3_
_Z22inline_assertion_checkILb1ERKPK7uint256EOT0_S6_PKciS8_S8_
Line
Count
Source
77
494k
{
78
494k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
494k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
494k
    }
83
494k
    return std::forward<T>(val);
84
494k
}
_Z22inline_assertion_checkILb0ERbEOT0_S2_PKciS4_S4_
Line
Count
Source
77
301k
{
78
301k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
301k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
301k
    }
83
301k
    return std::forward<T>(val);
84
301k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERPN6wallet14LegacyDataSPKMEEOT0_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKNSt3__110unique_ptrI17ChainstateManagerNS0_14default_deleteIS2_EEEEEOT0_S9_PKciSB_SB_
_Z22inline_assertion_checkILb1EP10CTxMemPoolEOT0_S3_PKciS5_S5_
Line
Count
Source
77
38.8k
{
78
38.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
38.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
38.8k
    }
83
38.8k
    return std::forward<T>(val);
84
38.8k
}
_Z22inline_assertion_checkILb1ERNSt3__16atomicIbEEEOT0_S5_PKciS7_S7_
Line
Count
Source
77
38.8k
{
78
38.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
38.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
38.8k
    }
83
38.8k
    return std::forward<T>(val);
84
38.8k
}
_Z22inline_assertion_checkILb1ERNSt3__18functionIFbvEEEEOT0_S6_PKciS8_S8_
Line
Count
Source
77
38.8k
{
78
38.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
38.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
38.8k
    }
83
38.8k
    return std::forward<T>(val);
84
38.8k
}
_Z22inline_assertion_checkILb1ERNSt3__110unique_ptrIN4node8WarningsENS0_14default_deleteIS3_EEEEEOT0_S9_PKciSB_SB_
Line
Count
Source
77
38.8k
{
78
38.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
38.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
38.8k
    }
83
38.8k
    return std::forward<T>(val);
84
38.8k
}
_Z22inline_assertion_checkILb1ERPN4util15SignalInterruptEEOT0_S5_PKciS7_S7_
Line
Count
Source
77
38.8k
{
78
38.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
38.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
38.8k
    }
83
38.8k
    return std::forward<T>(val);
84
38.8k
}
_Z22inline_assertion_checkILb1ERKN4util6ResultIvEEEOT0_S6_PKciS8_S8_
Line
Count
Source
77
38.8k
{
78
38.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
38.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
38.8k
    }
83
38.8k
    return std::forward<T>(val);
84
38.8k
}
_Z22inline_assertion_checkILb1EPK11CBlockIndexEOT0_S4_PKciS6_S6_
Line
Count
Source
77
19.8k
{
78
19.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
19.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
19.8k
    }
83
19.8k
    return std::forward<T>(val);
84
19.8k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1EP17evhttp_connectionEOT0_S3_PKciS5_S5_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERP14evhttp_requestEOT0_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPK17evhttp_connectionEOT0_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKPK6CBlockEOT0_S6_PKciS8_S8_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKPK10CBlockUndoEOT0_S6_PKciS8_S8_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ENSt3__18optionalI7uint256EEEOT0_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERNSt3__18optionalIN4util15SignalInterruptEEEEOT0_S7_PKciS9_S9_
Unexecuted instantiation: _Z22inline_assertion_checkILb1EN4util6ResultIvEEEOT0_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERNSt3__110unique_ptrI17ValidationSignalsNS0_14default_deleteIS2_EEEEEOT0_S8_PKciSA_SA_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERNSt3__110unique_ptrIN4node19KernelNotificationsENS0_14default_deleteIS3_EEEEEOT0_S9_PKciSB_SB_
_Z22inline_assertion_checkILb1EP11CBlockIndexEOT0_S3_PKciS5_S5_
Line
Count
Source
77
906k
{
78
906k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
906k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
906k
    }
83
906k
    return std::forward<T>(val);
84
906k
}
_Z22inline_assertion_checkILb1ERP11CBlockIndexEOT0_S4_PKciS6_S6_
Line
Count
Source
77
188k
{
78
188k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
188k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
188k
    }
83
188k
    return std::forward<T>(val);
84
188k
}
net_processing.cpp:_Z22inline_assertion_checkILb1EPN12_GLOBAL__N_110CNodeStateEEOT0_S4_PKciS6_S6_
Line
Count
Source
77
428k
{
78
428k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
428k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
428k
    }
83
428k
    return std::forward<T>(val);
84
428k
}
Unexecuted instantiation: net_processing.cpp:_Z22inline_assertion_checkILb1ENSt3__110shared_ptrIN12_GLOBAL__N_14PeerEEEEOT0_S6_PKciS8_S8_
_Z22inline_assertion_checkILb0EP11CBlockIndexEOT0_S3_PKciS5_S5_
Line
Count
Source
77
36.5k
{
78
36.5k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
36.5k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
36.5k
    }
83
36.5k
    return std::forward<T>(val);
84
36.5k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKNSt3__18optionalI14AssumeutxoDataEEEOT0_S7_PKciS9_S9_
_Z22inline_assertion_checkILb1ERNSt3__18optionalIN4node15BlockfileCursorEEEEOT0_S7_PKciS9_S9_
Line
Count
Source
77
31.4k
{
78
31.4k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
31.4k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
31.4k
    }
83
31.4k
    return std::forward<T>(val);
84
31.4k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPN4node11NodeContextEEOT0_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_assertion_checkILb1EPN4node11NodeContextEEOT0_S4_PKciS6_S6_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPN10interfaces12WalletLoaderEEOT0_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERKPK10CTxMemPoolEOT0_S6_PKciS8_S8_
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERKNSt3__18optionalI7uint256EEEOT0_S7_PKciS9_S9_
Unexecuted instantiation: _Z22inline_assertion_checkILb0ENSt3__18optionalI7uint256EEEOT0_S5_PKciS7_S7_
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERPKN7TxGraph3RefEEOT0_S6_PKciS8_S8_
Unexecuted instantiation: txgraph.cpp:_Z22inline_assertion_checkILb0ERPN12_GLOBAL__N_17ClusterEEOT0_S5_PKciS7_S7_
_Z22inline_assertion_checkILb0ERN4util6ResultINSt3__13setIN5boost11multi_index6detail21hashed_index_iteratorINS6_17hashed_index_nodeINS8_INS6_18ordered_index_nodeINS6_19null_augment_policyENS9_ISA_NS9_ISA_NS6_15index_node_baseI15CTxMemPoolEntryNS2_9allocatorISC_EEEEEEEEEEEEEENS6_12bucket_arrayISE_EENS6_17hashed_unique_tagENS6_32hashed_index_global_iterator_tagEEE21CompareIteratorByHashNSD_ISP_EEEEEEEOT0_SW_PKciSY_SY_
Line
Count
Source
77
2.95M
{
78
2.95M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
2.95M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
2.95M
    }
83
2.95M
    return std::forward<T>(val);
84
2.95M
}
_Z22inline_assertion_checkILb0EN4util6ResultINSt3__13setIN5boost11multi_index6detail21hashed_index_iteratorINS6_17hashed_index_nodeINS8_INS6_18ordered_index_nodeINS6_19null_augment_policyENS9_ISA_NS9_ISA_NS6_15index_node_baseI15CTxMemPoolEntryNS2_9allocatorISC_EEEEEEEEEEEEEENS6_12bucket_arrayISE_EENS6_17hashed_unique_tagENS6_32hashed_index_global_iterator_tagEEE21CompareIteratorByHashNSD_ISP_EEEEEEEOT0_SV_PKciSX_SX_
Line
Count
Source
77
301k
{
78
301k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
301k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
301k
    }
83
301k
    return std::forward<T>(val);
84
301k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb0ERNSt3__110unique_ptrIN10CTxMemPool9ChangeSetENS0_14default_deleteIS3_EEEEEOT0_S9_PKciSB_SB_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERPK7uint256EOT0_S5_PKciS7_S7_
_Z22inline_assertion_checkILb1ERKNSt3__18optionalIiEEEOT0_S6_PKciS8_S8_
Line
Count
Source
77
4.51M
{
78
4.51M
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
4.51M
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
4.51M
    }
83
4.51M
    return std::forward<T>(val);
84
4.51M
}
_Z22inline_assertion_checkILb0ERKP11CBlockIndexEOT0_S5_PKciS7_S7_
Line
Count
Source
77
140k
{
78
140k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
140k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
140k
    }
83
140k
    return std::forward<T>(val);
84
140k
}
Unexecuted instantiation: _Z22inline_assertion_checkILb1ERNSt3__110unique_ptrI10ChainstateNS0_14default_deleteIS2_EEEEEOT0_S8_PKciSA_SA_
Unexecuted instantiation: _Z22inline_assertion_checkILb1ENSt3__18optionalIN2fs4pathEEEEOT0_S6_PKciS8_S8_
_Z22inline_assertion_checkILb1ERNSt3__110unique_ptrIN4util19TaskRunnerInterfaceENS0_14default_deleteIS3_EEEEEOT0_S9_PKciSB_SB_
Line
Count
Source
77
38.8k
{
78
38.8k
    if (IS_ASSERT || 
std::is_constant_evaluated()0
||
G_FUZZING_BUILD0
||
G_ABORT_ON_FAILED_ASSUME0
) {
79
38.8k
        if (!val) {
80
0
            assertion_fail(file, line, func, assertion);
81
0
        }
82
38.8k
    }
83
38.8k
    return std::forward<T>(val);
84
38.8k
}
85
86
// All macros may use __func__ inside a lambda, so put them under nolint.
87
// NOLINTBEGIN(bugprone-lambda-function-name)
88
89
0
#define STR_INTERNAL_BUG(msg) StrFormatInternalBug((msg), __FILE__, __LINE__, __func__)
90
91
/**
92
 * Identity function. Throw a NonFatalCheckError when the condition evaluates to false
93
 *
94
 * This should only be used
95
 * - where the condition is assumed to be true, not for error handling or validating user input
96
 * - where a failure to fulfill the condition is recoverable and does not abort the program
97
 *
98
 * For example in RPC code, where it is undesirable to crash the whole program, this can be generally used to replace
99
 * asserts or recoverable logic errors. A NonFatalCheckError in RPC code is caught and passed as a string to the RPC
100
 * caller, which can then report the issue to the developers.
101
 */
102
#define CHECK_NONFATAL(condition) \
103
4.04M
    inline_check_non_fatal(
condition0
, __FILE__, __LINE__, __func__, #condition)
Unexecuted instantiation: blockchain.cpp:_ZZL12GetUTXOStatsP10CCoinsViewRN4node12BlockManagerEN6kernel17CoinStatsHashTypeERKNSt3__18functionIFvvEEEPK11CBlockIndexbENK3$_0clEv
Unexecuted instantiation: blockchain.cpp:_ZZZL10scanblocksvENK3$_0clERK10RPCHelpManRK14JSONRPCRequestENKUlvE0_clEv
104
105
/** Identity function. Abort if the value compares equal to zero */
106
41.6M
#define Assert(val) inline_assertion_check<true>(
val31.4k
, __FILE__, __LINE__, __func__, #val)
Unexecuted instantiation: txmempool.cpp:_ZZ31CheckMempoolEphemeralInvariantsRK10CTxMemPoolENK3$_0clERK5CTxIn
blockstorage.cpp:_ZZN4node12BlockManager14WriteBlockUndoERK10CBlockUndoR20BlockValidationStateR11CBlockIndexENK3$_0clEv
Line
Count
Source
106
31.4k
#define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
107
108
/**
109
 * Assume is the identity function.
110
 *
111
 * - Should be used to run non-fatal checks. In debug builds it behaves like
112
 *   Assert()/assert() to notify developers and testers about non-fatal errors.
113
 *   In production it doesn't warn or log anything.
114
 * - For fatal errors, use Assert().
115
 * - For non-fatal errors in interactive sessions (e.g. RPC or command line
116
 *   interfaces), CHECK_NONFATAL() might be more appropriate.
117
 */
118
50.8M
#define Assume(val) inline_assertion_check<false>(
val22.2M
, __FILE__, __LINE__, __func__, #val)
Unexecuted instantiation: scriptpubkeyman.cpp:_ZZNK6wallet25DescriptorScriptPubKeyMan6GetKeyERK6CKeyIDENK3$_0clERKNSt3__16vectorIh16secure_allocatorIhEEE
Unexecuted instantiation: wallet.cpp:_ZZNK6wallet7CWallet19GetScriptPubKeyMansERK7CScriptENK3$_0clEPNS_15ScriptPubKeyManE
net_processing.cpp:_ZZN12_GLOBAL__N_115PeerManagerImpl14ProcessMessageER5CNodeRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEER10DataStreamNS3_6chrono8durationIxNS3_5ratioILl1ELl1000000EEEEERKNS3_6atomicIbEEENK3$_1clEv
Line
Count
Source
118
153k
#define Assume(val) inline_assertion_check<false>(val, __FILE__, __LINE__, __func__, #val)
Unexecuted instantiation: mini_miner.cpp:_ZZNK4node9MiniMiner11SanityCheckEvENK3$_0clINSt3__114__map_iteratorINS3_15__tree_iteratorINS3_12__value_typeI22transaction_identifierILb0EENS_21MiniMinerMempoolEntryEEEPNS3_11__tree_nodeISA_PvEElEEEEEEDaRKT_
Unexecuted instantiation: mini_miner.cpp:_ZZNK4node9MiniMiner11SanityCheckEvENK3$_1clI22transaction_identifierILb0EEEEDaRKT_
ephemeral_policy.cpp:_ZZ20CheckEphemeralSpendsRKNSt3__16vectorINS_10shared_ptrIK12CTransactionEENS_9allocatorIS4_EEEE8CFeeRateRK10CTxMemPoolR17TxValidationStateR22transaction_identifierILb1EEENK3$_0clIS4_EEDaRKT_
Line
Count
Source
118
389k
#define Assume(val) inline_assertion_check<false>(val, __FILE__, __LINE__, __func__, #val)
119
120
/**
121
 * NONFATAL_UNREACHABLE() is a macro that is used to mark unreachable code. It throws a NonFatalCheckError.
122
 */
123
#define NONFATAL_UNREACHABLE()                                        \
124
0
    throw NonFatalCheckError(                                         \
125
0
        "Unreachable code reached (non-fatal)", __FILE__, __LINE__, __func__)
126
127
// NOLINTEND(bugprone-lambda-function-name)
128
129
#if defined(__has_feature)
130
#    if __has_feature(address_sanitizer)
131
#       include <sanitizer/asan_interface.h>
132
#    endif
133
#endif
134
135
#ifndef ASAN_POISON_MEMORY_REGION
136
13.0M
#   define ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
137
20.8M
#   define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
138
#endif
139
140
#endif // BITCOIN_UTIL_CHECK_H