mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-25 22:39:13 +02:00
refactor: Use const reference to std::source_location
Performance likely does not matter here, but from a perspective of code-readablilty, a const reference should be preferred for read-only access. So use it here. This requires to set -Wno-error=dangling-reference for GCC 13.1 compilations, but this false-positive is fixed in later GCC versions. See also https://godbolt.org/z/fjc6be65M
This commit is contained in:
@@ -66,7 +66,7 @@ void assertion_fail(const std::source_location& loc, std::string_view assertion)
|
||||
|
||||
/** Helper for CHECK_NONFATAL() */
|
||||
template <typename T>
|
||||
T&& inline_check_non_fatal(LIFETIMEBOUND T&& val, std::source_location loc, std::string_view assertion)
|
||||
T&& inline_check_non_fatal(LIFETIMEBOUND T&& val, const std::source_location& loc, std::string_view assertion)
|
||||
{
|
||||
if (!val) {
|
||||
if constexpr (G_ABORT_ON_FAILED_ASSUME) {
|
||||
@@ -83,7 +83,7 @@ T&& inline_check_non_fatal(LIFETIMEBOUND T&& val, std::source_location loc, std:
|
||||
|
||||
/** Helper for Assert()/Assume() */
|
||||
template <bool IS_ASSERT, typename T>
|
||||
constexpr T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] std::source_location loc, [[maybe_unused]] std::string_view assertion)
|
||||
constexpr T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const std::source_location& loc, [[maybe_unused]] std::string_view assertion)
|
||||
{
|
||||
if (IS_ASSERT || std::is_constant_evaluated() || G_ABORT_ON_FAILED_ASSUME) {
|
||||
if (!val) {
|
||||
|
||||
Reference in New Issue
Block a user