aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-08-16 14:55:19 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-08-16 14:56:37 +0200
commitfa60fa3b0cba4a30726af8e0e9d1e84e14849eda (patch)
tree094215259c968a711a23ee501ca4f43daa0809df /contrib
parentfaa11434fe38aa82892802adb6d879d112ae1675 (diff)
bitcoin-tidy: Apply bitcoin-unterminated-logprintf to spkm as well
Diffstat (limited to 'contrib')
-rw-r--r--contrib/devtools/bitcoin-tidy/example_logprintf.cpp18
-rw-r--r--contrib/devtools/bitcoin-tidy/logprintf.cpp2
2 files changed, 18 insertions, 2 deletions
diff --git a/contrib/devtools/bitcoin-tidy/example_logprintf.cpp b/contrib/devtools/bitcoin-tidy/example_logprintf.cpp
index 3106a0c161..a12a666c08 100644
--- a/contrib/devtools/bitcoin-tidy/example_logprintf.cpp
+++ b/contrib/devtools/bitcoin-tidy/example_logprintf.cpp
@@ -43,6 +43,20 @@ public:
};
};
+struct ScriptPubKeyMan
+{
+ std::string GetDisplayName() const
+ {
+ return "default wallet";
+ }
+
+ template <typename... Params>
+ void WalletLogPrintf(const char* fmt, Params... parameters) const
+ {
+ LogPrintf(("%s " + std::string{fmt}).c_str(), GetDisplayName(), parameters...);
+ };
+};
+
void good_func()
{
LogPrintf("hello world!\n");
@@ -51,6 +65,8 @@ void good_func2()
{
CWallet wallet;
wallet.WalletLogPrintf("hi\n");
+ ScriptPubKeyMan spkm;
+ spkm.WalletLogPrintf("hi\n");
const CWallet& walletref = wallet;
walletref.WalletLogPrintf("hi\n");
@@ -80,6 +96,8 @@ void bad_func5()
{
CWallet wallet;
wallet.WalletLogPrintf("hi");
+ ScriptPubKeyMan spkm;
+ spkm.WalletLogPrintf("hi");
const CWallet& walletref = wallet;
walletref.WalletLogPrintf("hi");
diff --git a/contrib/devtools/bitcoin-tidy/logprintf.cpp b/contrib/devtools/bitcoin-tidy/logprintf.cpp
index 1690c8fde0..36beac28c8 100644
--- a/contrib/devtools/bitcoin-tidy/logprintf.cpp
+++ b/contrib/devtools/bitcoin-tidy/logprintf.cpp
@@ -36,14 +36,12 @@ void LogPrintfCheck::registerMatchers(clang::ast_matchers::MatchFinder* finder)
this);
/*
- CWallet wallet;
auto walletptr = &wallet;
wallet.WalletLogPrintf("foo");
wallet->WalletLogPrintf("foo");
*/
finder->addMatcher(
cxxMemberCallExpr(
- thisPointerType(qualType(hasDeclaration(cxxRecordDecl(hasName("CWallet"))))),
callee(cxxMethodDecl(hasName("WalletLogPrintf"))),
hasArgument(0, stringLiteral(unterminated()).bind("logstring"))),
this);