On Sun, Dec 5, 2010 at 7:48 PM, Robert Collins <robe...@robertcollins.net> wrote: > On Mon, Dec 6, 2010 at 3:28 AM, Kinkie <gkin...@gmail.com> wrote: >> Hi all, >> Eric Raymond recently released a tool named deheader >> (http://www.catb.org/esr/deheader/) which goes through c/c++ project >> looking for unneeded includes. >> It does so by trying to compile each source file after removing one >> #include statement at a time, and seeing if it builds. > > Thats a fairly flawed approach. > > Two reasons: > - some headers when present affect correctness, not compilation. > - on some platforms headers are mandatory, on others optional. > > So, if you do this, be sure to take the minimal approach after > building on *all* platforms, and then still be conservative.
I agree To address those issues I'm focusing on squid internal headers, and in most cases only turning includes for squid.h into includes for config.h. I'm relying on a matrix build to track system dependencies, and on unit tests to catch correctness issues. On the plus side, this effort involves massive amounts of cpu power and elapsed-time but not as much brainpower, so if it all is for nothing, it won't be a big waste. -- /kinkie