Skip to content

style: remove unused include statements#8412

Open
vil02 wants to merge 2 commits intodanmar:mainfrom
vil02:remove_unused_includes
Open

style: remove unused include statements#8412
vil02 wants to merge 2 commits intodanmar:mainfrom
vil02:remove_unused_includes

Conversation

@vil02
Copy link
Copy Markdown
Contributor

@vil02 vil02 commented Apr 4, 2026

No description provided.

@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Apr 4, 2026

Thanks for your contribution.

How did you determine this? We regularly use include-what-you-use and (to a much lesser extent) clang-include-cleaner (aka misc-include-cleaner in clang-tidy) to determine which includes are actually required. See https://github.com/danmar/cppcheck/actions/workflows/iwyu.yml.

In simplecpp the clang-tidy check is even enabled but in Cppcheck we are still dealing with too many issues to make to do that. If we ever such reach a point it will be enabled in the regular CI.

All known IWYU issues have been reported upstream and the biggest issue is currently Qt which requires an updated version of the mappings generator included from IWYU. In case of clang-tidy not all issue might have been reported but it is only the second choice.

@vil02
Copy link
Copy Markdown
Contributor Author

vil02 commented Apr 4, 2026

How did you determine this?

I simply looked for files, which include list, but do not use std::list, include vector, but do not use std::vector etc.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 4, 2026

@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Apr 4, 2026

I simply looked for files, which include list, but do not use std::list, include vector, but do not use std::vector etc.

That sounds like one of the known shortcomings in IWYU. There's already several suggestions to add includes which I did not apply. So the changes might be correct and make things cleaner (although not having any effects), it will generate much much more noise in the output I have to check manually (I even considered adding the unnecessary ones so there is even less noise but that might cause some yet unknown false positives be to shadowed).

So as it doesn't actually improve things I will not apply these changes.

@vil02 vil02 marked this pull request as ready for review April 4, 2026 21:33
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