Peter Eisentraut <peter@eisentraut.org> writes:
> Approaches like that as well as the in-tree pgrminclude work by "I
> removed the #include and it still compiled fine", which can be
> unreliable. IWYU on the other hand has the compiler tracking where a
> symbol actually came from, and so if it says that an #include is not
> used, then it's pretty much correct by definition.
Well, it might be correct by definition for the version of the code
that the compiler processed. But it sounds to me like it's just as
vulnerable as pgrminclude to taking out #includes that are needed
only by #ifdef'd code sections that you didn't compile.
On the whole, our experience with automated #include removal is
pretty awful. I'm not sure I want to go there again.
regards, tom lane