Skip to content

small Check::analyseWholeProgram() related cleanup#7203

Merged
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:ctu-cleanup
Jan 11, 2025
Merged

small Check::analyseWholeProgram() related cleanup#7203
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:ctu-cleanup

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented Jan 9, 2025

No description provided.

@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Jan 9, 2025

The application code was never omitting the ctu parameter so no need for having it as a pointer.

@firewave firewave changed the title Check::analyseWholeProgram() related cleanup small Check::analyseWholeProgram() related cleanup Jan 9, 2025
Copy link
Copy Markdown
Collaborator

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Jan 11, 2025

It would be nice to have a cppcheck check that could detect such pointer arguments. :-)

Maybe not easy to implement, we did pass a nullptr in the testclass.

@firewave
Copy link
Copy Markdown
Collaborator Author

It would be nice to have a cppcheck check that could detect such pointer arguments. :-)

There is a ticket about detected unchecked dereferences - but that would not have fired either.

Maybe not easy to implement, we did pass a nullptr in the testclass.

That's why it is good to have an analysis run without the tests included - see the CI run of unusedFunction to detect code only used in tests. Might make sense to include that into the security guide.

@firewave firewave merged commit b901fbe into cppcheck-opensource:main Jan 11, 2025
@firewave firewave deleted the ctu-cleanup branch January 11, 2025 14:55
@firewave
Copy link
Copy Markdown
Collaborator Author

The case with unchecked parameters is covered by https://trac.cppcheck.net/ticket/11566.

CLion/Rider has a warning if a parameter is always the same value. That would related to an seemingly invalid enhancement request I filed in https://trac.cppcheck.net/ticket/13531.

@firewave
Copy link
Copy Markdown
Collaborator Author

CLion/Rider has a warning if a parameter is always the same value

Actually Cppcheck also has this as knownArgument.

@firewave
Copy link
Copy Markdown
Collaborator Author

Actually Cppcheck also has this as knownArgument.

Actually that only seems to trigger in very specific cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants