Re: [PATCH 0/9] Add missing includes and forward declares
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 15, 2018, 04:55 UTC
- Message-ID
- <20180815045543.GA32543@aiede.svl.corp.google.com>
- In-Reply-To
- <20180815013825.GA12178@sigill.intra.peff.net>
Jeff King wrote:
> On Mon, Aug 13, 2018 at 11:24:37AM -0700, Junio C Hamano wrote: >> Jeff King wrote:
Show 13 quoted lines
>>> So I think the better test is a two-line .c file with: >>> >>> #include "git-compat-util.h" >>> #include $header_to_check >> >> But until that tightening happens, I do not actually mind the >> two-line .c file started with inclusion of cache.h instead of >> git-compat-util.h. That would limit the scope of this series >> further. > > I can go either way on this. Using cache.h makes Elijah's current series > a bit more focused. But I think we'd eventually want to go there anyway. > I don't have a strong opinion on doing it now or later.
For what it's worth, I'd been assuming that any header that is not self-contained after a #include of "git-compat-util.h" is a bug.
It's true that many .c files include git-compat-util.h via cache.h, making such a bug harder to notice. But the moment you write a source file that doesn't include cache.h you'd run into that problem, so it's worth fixing ahead-of-time anyway.
Thanks, Jonathan