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

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

 



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