Adrian Stoica
I'm not aware of any such tools, but it could be done with a Perl script that removes the includes one at a time, and then invokes the compiler. If the file compiles ok, it's probably safe to remove that include.
No, unfortunately not. A header might appear to be redundant because it is included by another, yet this may be a mere implementation detail which is subject to change and should not be relied upon. In the absence of a true module system this is impossible to determine. Also it could be that the header defines template specialisations, or macros with the same names as functions/objects. Removing such a header might not make the program ill-formed but could still break it subtly. Instantiating a template in one translation unit for the same template arguments for which there is an explicit specialisation in another translation unit results in undefined behaviour. With sufficient testing you can *probably* avoid such mishaps but I would be very wary of trying to automate this.