aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-30 16:10:32 +0200
committerMacroFake <falke.marco@gmail.com>2022-08-02 13:40:42 +0200
commitfa3ea81c3e7d962715788ab5525958a532c51414 (patch)
treeffccc0675b1d06226189652773c9feb2ec3ac73b /src/util
parent816ca01650f4cc66a61ac2f9b0f8b74cd9cd0cf8 (diff)
downloadbitcoin-fa3ea81c3e7d962715788ab5525958a532c51414.tar.xz
refactor: Add LIFETIMEBOUND / -Wdangling-gsl to Assert()
Diffstat (limited to 'src/util')
-rw-r--r--src/util/check.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/util/check.h b/src/util/check.h
index aca957925a..49f07de9dd 100644
--- a/src/util/check.h
+++ b/src/util/check.h
@@ -9,6 +9,7 @@
#include <config/bitcoin-config.h>
#endif
+#include <attributes.h>
#include <tinyformat.h>
#include <stdexcept>
@@ -24,7 +25,7 @@ class NonFatalCheckError : public std::runtime_error
/** Helper for CHECK_NONFATAL() */
template <typename T>
-T&& inline_check_non_fatal(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)
{
if (!(val)) {
throw NonFatalCheckError(
@@ -56,7 +57,7 @@ void assertion_fail(const char* file, int line, const char* func, const char* as
/** Helper for Assert()/Assume() */
template <bool IS_ASSERT, typename T>
-T&& inline_assertion_check(T&& val, [[maybe_unused]] const char* file, [[maybe_unused]] int line, [[maybe_unused]] const char* func, [[maybe_unused]] const char* assertion)
+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)
{
if constexpr (IS_ASSERT
#ifdef ABORT_ON_FAILED_ASSUME