Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless includes (using include-what-you-use) #5860

Closed
JohannesLorenz opened this issue Dec 24, 2020 · 2 comments
Closed

Remove useless includes (using include-what-you-use) #5860

JohannesLorenz opened this issue Dec 24, 2020 · 2 comments
Assignees

Comments

@JohannesLorenz
Copy link
Contributor

JohannesLorenz commented Dec 24, 2020

Enhancement Summary

There's a tool to find them:

cmake -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp" -DCMAKE_C_INCLUDE_WHAT_YOU_USE="include-what-you-use;-Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp" ..

If the tool is named "iwyu" instead, use that in the CMake command above.

The tool gives headers that should be

  • added if you follow the principle to include every header if you use a definition from it (decided against that in discord)
  • removed (because they are useless)

The tool gets a bit confused by Qt, it asks to replace stuff like by "qstring.h" - this can be ignored.

When you submit a PR it should not contain any removement suggestions.

Justification

Compile time matters, and I wonder how much we would win if we would remove all useless includes.

@JohannesLorenz JohannesLorenz changed the title Remove useless headers (using include-what-you-use) Remove useless includes (using include-what-you-use) Jun 19, 2021
@JohannesLorenz JohannesLorenz self-assigned this Feb 21, 2022
@Spekular
Copy link
Member

This should be closed, right?

@JohannesLorenz
Copy link
Contributor Author

Yes. Thanks for the reminder!

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

No branches or pull requests

2 participants