Thread (8 messages) 8 messages, 4 authors, 2016-06-15

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

flat view

From: Jonathan Nieder <hidden>
Date: 2016-06-15 23:02:27
Subsystem: the rest · Maintainer: Linus Torvalds

Hi,

David Aguilar wrote:
quoted hunk ↗ jump to hunk
--- /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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help