Re: [PATCH 02/16] treewide: remove unnecessary git-compat-util.h includes in headers

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

 



"Elijah Newren via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Elijah Newren <newren@xxxxxxxxx>
>
> Since git-compat-util.h needs to be included first in C files, having it
> appear in header files is unnecessary.  More importantly, having it
> included in header files seems to lead to folks leaving it out of C
> files, which makes it harder to verify that the rule is being followed.
> Remove it from header files, other than the ones that have been approved
> as alternate first includes.

Hmph, doesn't this cut both ways?  

I like the idea that the removal of compat-util from other
header files may increase the likelihood that a C file that includes
such header files without including compat-util fail to compile,
because it would fail to find what is defined or declared in
compat-util.

But from "include what you use" point of view, shouldn't a header
that defines or declares its own stuff using what is defined or
declared in compat-util be including compat-util itself?

Or do I misunderstand what "make hdr-check" is trying to achieve?

Granted that the check does not fail with this patch in place, but I
suspect that it is by accident (i.e. there happens to be nobody who
depends on what is defined/declared in compat-util for their own
definition or declaration).  Also I am not sure how to interpret
the fact that "make hdr-check" succeeds with this patch.  Does it
mean C files that include these header files while forgetting to
include compat-util may not be caught by the compiler after all?

So, I dunno.





[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