Re: [PATCH 0/9] Add missing includes and forward declares

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> The rule in Git has always been that your very first include must
> always be "git-compat-util.h" or an equivalent header that includes it
> first (like "cache.h"). This is mentioned in CodingGuidelines.

Glad to see that you already have written the above so I don't have
to ;-)

As things are slowly moving out of the so-far kitchen-sink "cache.h"
into more specific subsystem headers (like object-store.h), we may
actually want to tighten the "header that includes it first" part a
bit in the future, so that 'git grep cache.h' would give us a more
explicit and a better picture of what really depends on knowing what
the lowest level plumbing API are built around.

> 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 wonder if there's an easy way to check. I guess adding '-Dint=foo' to
> the command line, and then putting '#undef int' at the top of
> git-compat-util would catch just about any code the compiler sees that
> doesn't have git-compat-util included. :)

;-).



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux