mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Fix bugprone-lambda-function-name errors
Can be reviewed with --color-moved=dimmed-zebra
This commit is contained in:
parent
2a349f9ea5
commit
faa769db5a
4 changed files with 25 additions and 19 deletions
|
@ -3,6 +3,7 @@ Checks: '
|
||||||
bitcoin-*,
|
bitcoin-*,
|
||||||
bugprone-argument-comment,
|
bugprone-argument-comment,
|
||||||
bugprone-use-after-move,
|
bugprone-use-after-move,
|
||||||
|
bugprone-lambda-function-name,
|
||||||
misc-unused-using-decls,
|
misc-unused-using-decls,
|
||||||
modernize-use-default-member-init,
|
modernize-use-default-member-init,
|
||||||
modernize-use-emplace,
|
modernize-use-emplace,
|
||||||
|
|
|
@ -465,7 +465,7 @@ static RPCHelpMan getmempoolancestors()
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not in mempool");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not in mempool");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ancestors{mempool.AssumeCalculateMemPoolAncestors(__func__, *it, CTxMemPool::Limits::NoLimits(), /*fSearchForParents=*/false)};
|
auto ancestors{mempool.AssumeCalculateMemPoolAncestors(self.m_name, *it, CTxMemPool::Limits::NoLimits(), /*fSearchForParents=*/false)};
|
||||||
|
|
||||||
if (!fVerbose) {
|
if (!fVerbose) {
|
||||||
UniValue o(UniValue::VARR);
|
UniValue o(UniValue::VARR);
|
||||||
|
|
|
@ -20,8 +20,6 @@ public:
|
||||||
NonFatalCheckError(std::string_view msg, std::string_view file, int line, std::string_view func);
|
NonFatalCheckError(std::string_view msg, std::string_view file, int line, std::string_view func);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STR_INTERNAL_BUG(msg) StrFormatInternalBug((msg), __FILE__, __LINE__, __func__)
|
|
||||||
|
|
||||||
/** Helper for CHECK_NONFATAL() */
|
/** Helper for CHECK_NONFATAL() */
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T&& inline_check_non_fatal(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)
|
||||||
|
@ -32,20 +30,6 @@ T&& inline_check_non_fatal(LIFETIMEBOUND T&& val, const char* file, int line, co
|
||||||
return std::forward<T>(val);
|
return std::forward<T>(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
#define CHECK_NONFATAL(condition) \
|
|
||||||
inline_check_non_fatal(condition, __FILE__, __LINE__, __func__, #condition)
|
|
||||||
|
|
||||||
#if defined(NDEBUG)
|
#if defined(NDEBUG)
|
||||||
#error "Cannot compile without assertions!"
|
#error "Cannot compile without assertions!"
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,6 +53,25 @@ T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* f
|
||||||
return std::forward<T>(val);
|
return std::forward<T>(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All macros may use __func__ inside a lambda, so put them under nolint.
|
||||||
|
// NOLINTBEGIN(bugprone-lambda-function-name)
|
||||||
|
|
||||||
|
#define STR_INTERNAL_BUG(msg) StrFormatInternalBug((msg), __FILE__, __LINE__, __func__)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
#define CHECK_NONFATAL(condition) \
|
||||||
|
inline_check_non_fatal(condition, __FILE__, __LINE__, __func__, #condition)
|
||||||
|
|
||||||
/** Identity function. Abort if the value compares equal to zero */
|
/** Identity function. Abort if the value compares equal to zero */
|
||||||
#define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
|
#define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
|
||||||
|
|
||||||
|
@ -91,4 +94,6 @@ T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* f
|
||||||
throw NonFatalCheckError( \
|
throw NonFatalCheckError( \
|
||||||
"Unreachable code reached (non-fatal)", __FILE__, __LINE__, __func__)
|
"Unreachable code reached (non-fatal)", __FILE__, __LINE__, __func__)
|
||||||
|
|
||||||
|
// NOLINTEND(bugprone-lambda-function-name)
|
||||||
|
|
||||||
#endif // BITCOIN_UTIL_CHECK_H
|
#endif // BITCOIN_UTIL_CHECK_H
|
||||||
|
|
|
@ -5953,8 +5953,8 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
|
||||||
fs::path p_old,
|
fs::path p_old,
|
||||||
fs::path p_new,
|
fs::path p_new,
|
||||||
const fs::filesystem_error& err) {
|
const fs::filesystem_error& err) {
|
||||||
LogPrintf("%s: error renaming file (%s): %s\n",
|
LogPrintf("Error renaming path (%s) -> (%s): %s\n",
|
||||||
__func__, fs::PathToString(p_old), err.what());
|
fs::PathToString(p_old), fs::PathToString(p_new), err.what());
|
||||||
GetNotifications().fatalError(strprintf(
|
GetNotifications().fatalError(strprintf(
|
||||||
"Rename of '%s' -> '%s' failed. "
|
"Rename of '%s' -> '%s' failed. "
|
||||||
"Cannot clean up the background chainstate leveldb directory.",
|
"Cannot clean up the background chainstate leveldb directory.",
|
||||||
|
|
Loading…
Add table
Reference in a new issue