Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/signalhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static const Signalmap_t listofsignals = {
* but when ending up here something went terribly wrong anyway.
* And all which is left is just printing some information and terminate.
*/
static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context) // cppcheck-suppress constParameterCallback - info can be const
{
int type = -1;
pid_t killid;
Expand Down
2 changes: 1 addition & 1 deletion lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ bool isAliasOf(const Token* tok, const Token* expr, nonneg int* indirect)
r = findAstNode(expr, [&](const Token* childTok) {
if (childTok->exprId() == 0)
return false;
if (ref.token != tok && expr->exprId() == childTok->exprId()) {
if (ref.token != tok && expr->exprId() == childTok->exprId() && ref.token->isUnaryOp("*") && expr->exprId() == ref.token->astOperand1()->exprId()) {
if (indirect)
*indirect = 0;
return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4101,7 +4101,7 @@ static bool intersects(const C1& c1, const C2& c2)
return false;
}

static void valueFlowAfterAssign(TokenList &tokenlist,
static void valueFlowAfterAssign(const TokenList &tokenlist,
const SymbolDatabase& symboldatabase,
ErrorLogger &errorLogger,
const Settings &settings,
Expand Down
12 changes: 12 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4749,6 +4749,18 @@ class TestOther : public TestFixture {
" return [](int* p) { return *p; }(&i);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3:20]: (style) Parameter 'p' can be declared as pointer to const [constParameterPointer]\n", errout_str());

check("struct S {\n" // #14571
" char* c;\n"
"};\n"
"struct T {\n"
" S s;\n"
"};\n"
"void f(std::string* p, T& t) {\n"
" S& r = t.s;\n"
" strcpy(r.c, p->c_str());\n"
"}\n");
ASSERT_EQUALS("[test.cpp:7:21]: (style) Parameter 'p' can be declared as pointer to const [constParameterPointer]\n", errout_str());
}

void constArray() {
Expand Down
Loading