git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: David Aguilar <davvid@gmail.com>
Cc: git@vger.kernel.org, "Jeff King" <peff@peff.net>,
	"René Scharfe" <l.s.r@web.de>
Subject: Re: [RFC PATCH v2 1/2] Makefile: add check-headers target
Date: Sun, 7 Sep 2014 12:42:27 -0700	[thread overview]
Message-ID: <20140907194227.GA1611@google.com> (raw)
In-Reply-To: <1410049821-49861-1-git-send-email-davvid@gmail.com>

Hi,

David Aguilar wrote:

> --- /dev/null
> +++ b/check-headers.sh
> @@ -0,0 +1,29 @@
[...]
> +	"$@" -Wno-unused -I"$subdir" -c -o "$header".check -x c - <"$header" &&

All .c files in git are supposed to start by #include-ing
git-compat-util.h, cache.h, or builtin.h to set the appropriate
feature test macros and include system headers.

Headers rely on that for basic types like int32_t.  They don't need to
include git-compat-util.h because the .c file that included them would
have already, and .h files #include-ed by git-compat-util.h especially
*shouldn't* #include the compat header, so how about something like
the following for squashing in?

A side-thought: as long as we're building pre-compiled headers, could
we use them in the build?

Thanks,
Jonathan

diff --git a/check-headers.sh b/check-headers.sh
index bf85c41..08ca136 100755
--- a/check-headers.sh
+++ b/check-headers.sh
@@ -18,7 +18,7 @@ git ls-files *.h |
 while read header
 do
 	echo "HEADER $header" &&
-	"$@" -Wno-unused -x c -c -o "$header".bin - <"$header" &&
+	"$@" -Wno-unused -x c -include git-compat-util.h -c -o "$header".bin - <"$header" &&
 	rm "$header".bin ||
 	maybe_exit $?
 done

  parent reply	other threads:[~2014-09-07 19:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-07  0:30 [RFC PATCH v2 1/2] Makefile: add check-headers target David Aguilar
2014-09-07  0:30 ` [RFC PATCH v2 2/2] headers: include dependent headers David Aguilar
2014-09-07  6:41   ` René Scharfe
2014-09-07 19:49   ` Jonathan Nieder
2014-09-07 19:54     ` Johannes Sixt
2014-09-07 20:01       ` Jonathan Nieder
2014-09-07 20:30     ` David Aguilar
2014-09-07 19:42 ` Jonathan Nieder [this message]
2014-09-08 18:56 ` [RFC PATCH v2 1/2] Makefile: add check-headers target Junio C Hamano
2014-09-08 19:29   ` Matthieu Moy
2014-09-08 19:57     ` Junio C Hamano
2014-09-10  0:03       ` David Aguilar
2014-09-10 17:09         ` Junio C Hamano
2014-09-10 17:24           ` Matthieu Moy

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=20140907194227.GA1611@google.com \
    --to=jrnieder@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    /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).