I'm looking for a tool which can do at least one of two things.
Is there such a tool?
You could use GCC warnings "-Wmissing-declarations" and "-Wredundant-decls". It's not precisely what you want, but might help a lot.
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 include in 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
for s in sourceFiles:
while t := commentNextInclude(s):
if compilationOk(): s := t
As I said, comment each #include in 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With