Skip to content

fixed some unusedFunction warnings#3618

Merged
danmar merged 6 commits into
cppcheck-opensource:mainfrom
firewave:unusedFunction
Jan 4, 2022
Merged

fixed some unusedFunction warnings#3618
danmar merged 6 commits into
cppcheck-opensource:mainfrom
firewave:unusedFunction

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

These were detected by running a self check with --enable=unusedFunction. I will file tickets for the false positives at a later date.

@firewave
Copy link
Copy Markdown
Collaborator Author

CLion does find a lot more unused code and I will try to add false negative tickets for those.

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 work! let's try the readingEmptyStlContainer2 maybe.

Comment thread lib/checkmemoryleak.cpp
Comment thread lib/checkstl.cpp
Comment thread lib/token.cpp
std::cout << stringifyList(stringifyOptions::forPrintOut(), &fileNames, nullptr) << std::endl;
}

void Token::printLines(int lines) const
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I had forgot about Token::printLines. I've always used Token::printOut during debugging but this looks more useful. Let's keep this.

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.

We should annotate this then with the unused/maybe_unused attribute - or a suppression if we do not support that yet.

@firewave
Copy link
Copy Markdown
Collaborator Author

Some need to be bisected for when the usage was dropped or if it ever existed.

@firewave firewave marked this pull request as draft December 14, 2021 13:24
@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Dec 17, 2021

I will file tickets for the false positives at a later date.

The false positives are caused since we do not process the generated GUI sources in the current self-check. Using the compilation database as input would probably solve this issue. I already used the compilation database...so these are actual false positives.

Comment thread lib/importproject.h
Comment thread lib/token.h
@firewave
Copy link
Copy Markdown
Collaborator Author

I restored some of the obvious helper functions for now so this can be merged. We can tackle these at a later date.

@firewave firewave marked this pull request as ready for review December 27, 2021 14:41
Comment thread lib/preprocessor.h
* preprocess all whitespaces
* @param processedFile The data to be processed
*/
static void preprocessWhitespaces(std::string &processedFile);
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.

The usage was removed in 3432257 - leftover code from removed feature so it can be deleted.

@firewave
Copy link
Copy Markdown
Collaborator Author

The build failure was a download failure. This can be reduced by merging #3612.

Comment thread lib/astutils.h
@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Jan 2, 2022

This can be merged. All other things related to this will be resolved when the CI job for this is being added.

@danmar danmar merged commit 0ba9cb4 into cppcheck-opensource:main Jan 4, 2022
@firewave firewave deleted the unusedFunction branch January 4, 2022 14:48
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