From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "SZEDER Gábor" <szeder@ira.uka.de>, git@vger.kernel.org
Subject: Re: [PATCH] wt-status: move #include "pathspec.h" to the header
Date: Thu, 20 Aug 2015 16:38:41 -0400 [thread overview]
Message-ID: <20150820203841.GA12386@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqq61497pc1.fsf@gitster.dls.corp.google.com>
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.
next prev parent reply other threads:[~2015-08-20 20:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-20 14:06 [PATCH] wt-status: move #include "pathspec.h" to the header SZEDER Gábor
2015-08-20 19:05 ` Junio C Hamano
2015-08-20 20:38 ` Jeff King [this message]
2015-08-20 22:35 ` SZEDER Gábor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150820203841.GA12386@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder@ira.uka.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).