git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Robert SchieleNext: Junio C Hamano
Message 3 of 8 in “Unused #include statements”
  1. Zoltan KlingerJan 15, 2015
  2. Robert SchieleJan 15, 2015
  3. Jeff KingJan 15, 2015
  4. Junio C HamanoJan 15, 2015
  5. Jeff KingJan 15, 2015
  6. Junio C HamanoJan 15, 2015
  7. Jeff KingJan 16, 2015
  8. Zoltan KlingerJan 20, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.