git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 1/2] Makefile: add check-headers target

From
René Scharfe <l.s.r@web.de>
Date
Sep 6, 2014, 21:20 UTC
Message-ID
<540B7AA0.4050208@web.de>
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.
Show 49 quoted lines
> 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.

Show 10 quoted lines
> +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
>
Previous: Junio C HamanoNext: David Aguilar
Message 7 of 10 in “Makefile: add check-headers target”
  1. 1/2 Makefile: add check-headers targetDavid Aguilar, Sep 6, 2014
  2. 2/2 headers: include dependent headersDavid Aguilar, Sep 6, 2014
  3. René ScharfeSep 6, 2014
  4. Junio C HamanoSep 8, 2014
  5. René ScharfeSep 9, 2014
  6. Junio C HamanoSep 8, 2014
  7. René ScharfeSep 6, 2014
  8. David AguilarSep 6, 2014
  9. Jeff KingSep 6, 2014
  10. David AguilarSep 7, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.