I’m looking for a tool which can do at least one of two things.
- Guess what headers might be unused and can be removed.
- Guess which headers should be included in a file, but are included indirectly through inclusion of other files. Thus allows proper compilation of the file.
Is there such a tool?
A colleague of mine wrote a very simple script to achieve part of this (and slow too…).
Basically the idea is to try to comment each
includein turn and then try to compile the object, it doesn’t deal with include within headers but already remove a substantial number of unused files 🙂EDIT:
Pseudo code of the algorithm
As I said, comment each
#includein turn, and each time check if the program still compiles, if it does, validate the commenting, and move on to the next one.I don’t have the rights to disclose the script source though.