зеркало из https://github.com/microsoft/git.git
Makefile: add a hdr-check target
Commit ef3ca95475
("Add missing includes and forward declarations",
2018-08-15) resulted from the author employing a manual method to
create a C file consisting of a pair of pre-processor #include
lines (for 'git-compat-util.h' and a given toplevel header), and
fixing any resulting compiler errors or warnings.
Add a Makefile target to automate this process. This implementation
relies on the '-include' and '-xc' arguments to the 'gcc' and 'clang'
compilers, which allows us to effectively create the required C
compilation unit on-the-fly. This limits the portability of this
solution to those systems which have such a compiler.
The new 'hdr-check' target can be used to check most header files in
the project (for various reasons, the 'compat' and 'xdiff' directories
are not included). Also, note that individual header files can be
checked directly using the '.hco' extension (read: Hdr-Check Object)
like so:
$ make config.hco
HDR config.h
$
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
2d3b1c576c
Коммит
ebb7baf02f
12
Makefile
12
Makefile
|
@ -1793,6 +1793,7 @@ ifndef V
|
|||
QUIET_MSGFMT = @echo ' ' MSGFMT $@;
|
||||
QUIET_GCOV = @echo ' ' GCOV $@;
|
||||
QUIET_SP = @echo ' ' SP $<;
|
||||
QUIET_HDR = @echo ' ' HDR $<;
|
||||
QUIET_RC = @echo ' ' RC $@;
|
||||
QUIET_SUBDIR0 = +@subdir=
|
||||
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
|
||||
|
@ -2675,6 +2676,17 @@ $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
|
|||
.PHONY: sparse $(SP_OBJ)
|
||||
sparse: $(SP_OBJ)
|
||||
|
||||
GEN_HDRS := command-list.h unicode-width.h
|
||||
EXCEPT_HDRS := $(GEN_HDRS) compat% xdiff%
|
||||
CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H)))
|
||||
HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
|
||||
|
||||
$(HCO): %.hco: %.h FORCE
|
||||
$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $<
|
||||
|
||||
.PHONY: hdr-check $(HCO)
|
||||
hdr-check: $(HCO)
|
||||
|
||||
.PHONY: style
|
||||
style:
|
||||
git clang-format --style file --diff --extensions c,h
|
||||
|
|
Загрузка…
Ссылка в новой задаче