All of lore.kernel.org
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: David Aguilar <davvid@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] Makefile: add check-headers target
Date: Sat, 06 Sep 2014 23:20:32 +0200	[thread overview]
Message-ID: <540B7AA0.4050208@web.de> (raw)
In-Reply-To: <1410031211-14599-1-git-send-email-davvid@gmail.com>

Am 06.09.2014 um 21:20 schrieb David Aguilar:
> This allows us to ensure that each header can be included
> individually without needing to include other headers first.

Sounds like a good objective.

> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> This patch demonstrates how to verify PATCH 2/2.
>
>   Makefile         |  6 ++++++
>   check-headers.sh | 26 ++++++++++++++++++++++++++
>   2 files changed, 32 insertions(+)
>   create mode 100755 check-headers.sh
>
> diff --git a/Makefile b/Makefile
> index 30cc622..bc54024 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2591,6 +2591,12 @@ check-docs::
>   check-builtins::
>   	./check-builtins.sh
>
> +### Make sure headers include their dependencies
> +#
> +check-headers::
> +	./check-headers.sh $(CC) $(ALL_CFLAGS)
> +
> +
>   ### Test suite coverage testing
>   #
>   .PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
> diff --git a/check-headers.sh b/check-headers.sh
> new file mode 100755
> index 0000000..bf85c41
> --- /dev/null
> +++ b/check-headers.sh
> @@ -0,0 +1,26 @@
> +#!/bin/sh
> +
> +exit_code=0
> +
> +maybe_exit () {
> +	status="$1"
> +	if test "$status" != 0
> +	then
> +		exit_code="$status"
> +		if test -n "$CHECK_HEADERS_STOP"
> +		then
> +			exit "$status"
> +		fi
> +	fi
> +}
> +
> +git ls-files *.h |

This checks all .h files in the top directory.  Would it be better to 
check all files in LIB_H instead?  Or even all .h files in the tree 
(using "git ls-files '*.h'")?  The latter might be difficult because 
some of the files in compat/ #include system-specific headers.

> +while read header
> +do
> +	echo "HEADER $header" &&
> +	"$@" -Wno-unused -x c -c -o "$header".bin - <"$header" &&
> +	rm "$header".bin ||
> +	maybe_exit $?
> +done
> +
> +exit $exit_code
>

  parent reply	other threads:[~2014-09-06 21:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-06 19:20 [RFC PATCH 1/2] Makefile: add check-headers target David Aguilar
2014-09-06 19:20 ` [RFC PATCH 2/2] headers: include dependent headers David Aguilar
2014-09-06 21:20   ` René Scharfe
2014-09-08 17:50     ` Junio C Hamano
2014-09-09 19:44       ` René Scharfe
2014-09-08 18:05     ` Junio C Hamano
2014-09-06 21:20 ` René Scharfe [this message]
2014-09-06 22:57   ` [RFC PATCH 1/2] Makefile: add check-headers target David Aguilar
2014-09-06 23:58     ` Jeff King
2014-09-07  0:24       ` David Aguilar

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=540B7AA0.4050208@web.de \
    --to=l.s.r@web.de \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.