Re: Unused #include statements
- From
Jeff King <peff@peff.net>
- Date
- Jan 15, 2015, 06:33 UTC
- Message-ID
- <20150115063307.GA11028@peff.net>
- In-Reply-To
- <CAObFj3wC6ezNQfAYvtepBdW3S0hv8c4_fXYTo-zp4wwddx3QXg@mail.gmail.com>
On Thu, Jan 15, 2015 at 05:14:39AM +0100, Robert Schiele wrote:
Show 5 quoted lines
> Thus doing those kind of brute-force removals generally makes the > include structure in a project very fragile. The analysis itself you > did is still useful to identify header files that can potentially be > removed but removing them without further analysis I would consider > problematic.
I would second that. Besides leading to a potentially fragile result, this analysis was done only for a particular platform with a particular set of config knobs.
One of our rules is that git-compat-util.h (or one of the well-known headers which includes, cache.h or builtin.h) is included first in any translation unit. This gives git-compat-util the cleanest environment possible for making decisions, and lets macros it defines effect the rest of the code consistently. I suspect on modern platforms like Linux/glibc that it is not a huge deal to include git-compat-util a little late, simply because it does not have all that much to do. But on Solaris 8? Who knows.
-Peff