Skip to content

moved global CheckUnusedFunctions instance to CppCheck / cleaned up CheckUnusedFunctions interface#6013

Merged
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:unused-xyz-2
Feb 27, 2024
Merged

moved global CheckUnusedFunctions instance to CppCheck / cleaned up CheckUnusedFunctions interface#6013
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:unused-xyz-2

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

No description provided.


// Check for unused functions..
CheckUnusedFunctions checkUnusedFunctions;
checkUnusedFunctions.parseTokens(tokenizer, "someFile.c", settings1);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Another case of a language mismatch between tokenizing and usage.

@firewave
Copy link
Copy Markdown
Collaborator Author

Will file tickets for the --clang-related issues later.

Comment thread lib/cppcheck.cpp

unsigned int CppCheck::check(const FileSettings &fs)
{
// TODO: move to constructor when CppCheck no longer owns the settings
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yet another case highlighting how all the current messes I am working on are woven together...

@firewave firewave marked this pull request as draft February 21, 2024 14:00
@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Feb 21, 2024

This looks like a false positive:

lib/checkunusedfunctions.cpp:473:29: style:inconclusive: Boolean expression 'usage.usedOtherFile' is used in bitwise operation. [bitwiseOnBoolean]
        usage.usedOtherFile |= entry.second.usedOtherFile;
                            ^

If both sides are just a bool type it should be safe.

@firewave
Copy link
Copy Markdown
Collaborator Author

I filed https://trac.cppcheck.net/ticket/12455 about the bitwiseOnBoolean false positive.

@firewave firewave marked this pull request as ready for review February 21, 2024 18:58
@@ -0,0 +1,7 @@
static void f4_0() {}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was a gap in the test coverage which was uncovered by me not properly propagating all the data in an earlier version of these changes.

@firewave firewave changed the title moved "global" CheckUnusedFunctions instance to CppCheck / cleaned up CheckUnusedFunctions interface moved global CheckUnusedFunctions instance to CppCheck / cleaned up CheckUnusedFunctions interface Feb 22, 2024
@firewave firewave merged commit 8c90edb into cppcheck-opensource:main Feb 27, 2024
@firewave firewave deleted the unused-xyz-2 branch February 27, 2024 15:51
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