Re: [PATCH] wt-status: move #include "pathspec.h" to the header

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

 



On Thu, Aug 20, 2015 at 12:05:34PM -0700, Junio C Hamano wrote:

> This is a tangent, but the above is different from saying that with
> a single liner test.c that has
> 
>     #include "wt-status.h"
> 
> your compilation "cc -c test.c" should succeed.  But for that goal,
> direct inclusion of <stdio.h> to wt-status.h is also iffy.  We
> include the system headers from git-compat-util.h because some
> platforms are picky about order of inclusion of system header files
> and definitions of feature test macros.
> 
> Right now, the codebase is correct only because it is NOT our goal
> to guarantee that such a single-liner test.c file compiles.
> Instead, everybody is instructed to #include "git-compat-util.h" as
> the first thing, either directly or indirectly.
> 
> So in that sense, we should also remove that inclusion from
> wt-status.h, I think.

Yeah, I think that is actively wrong. Running[1]:

  git grep '#include <' -- '*.h' ':!git-compat-util.h'

shows a few other weird ones. Things like zlib.h, pcre.h, etc, are
probably OK. They are not really "system" headers, and it is probably OK
as long as they come after git-compat-util (which they must, if they are
in a header file).

The inclusion of stdlib.h in compat/bswap.h is suspect (both are
included by git-compat-util itself). But it is inside an #ifdef _MSC_VER
block, so I cannot test that there is not some subtle interaction going
on.

A few headers include pthread.h. I would have thought that should go in
git-compat-util for the usual reasons, but nobody has complained (and
most files do not need it, though that has not generally stopped us from
making git-compat-util a catch-all for other system files).

-Peff

[1] Too bad I needed the "--" separator there. Recent git nicely learned
    to DWIM "*.h" as a pathspec, but we do not seem to give the same
    treatment to "magic" pathspecs.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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]