Skip to content

Commit 9728ab4

Browse files
committed
Merge branch 'dl/honor-cflags-in-hdr-check'
Dev support. * dl/honor-cflags-in-hdr-check: ci: run `hdr-check` as part of the `Static Analysis` job Makefile: emulate compile in $(HCO) target better pack-bitmap.h: remove magic number promisor-remote.h: include missing header apply.h: include missing header
2 parents 1f314d5 + 411e4f4 commit 9728ab4

8 files changed

+22
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
/tags
217217
/TAGS
218218
/cscope*
219+
*.hcc
219220
*.obj
220221
*.lib
221222
*.res

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,7 @@ ifndef V
18881888
QUIET_MSGFMT = @echo ' ' MSGFMT $@;
18891889
QUIET_GCOV = @echo ' ' GCOV $@;
18901890
QUIET_SP = @echo ' ' SP $<;
1891-
QUIET_HDR = @echo ' ' HDR $<;
1891+
QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
18921892
QUIET_RC = @echo ' ' RC $@;
18931893
QUIET_SUBDIR0 = +@subdir=
18941894
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
@@ -2788,9 +2788,14 @@ ifndef GCRYPT_SHA256
27882788
endif
27892789
CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
27902790
HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
2791+
HCC = $(HCO:hco=hcc)
27912792

2792-
$(HCO): %.hco: %.h FORCE
2793-
$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $<
2793+
%.hcc: %.h
2794+
@echo '#include "git-compat-util.h"' >$@
2795+
@echo '#include "$<"' >>$@
2796+
2797+
$(HCO): %.hco: %.hcc FORCE
2798+
$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
27942799

27952800
.PHONY: hdr-check $(HCO)
27962801
hdr-check: $(HCO)
@@ -3095,6 +3100,7 @@ clean: profile-clean coverage-clean cocciclean
30953100
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
30963101
$(RM) $(TEST_PROGRAMS)
30973102
$(RM) $(FUZZ_PROGRAMS)
3103+
$(RM) $(HCC)
30983104
$(RM) -r bin-wrappers $(dep_dirs)
30993105
$(RM) -r po/build/
31003106
$(RM) *.pyc *.pyo */*.pyc */*.pyo command-list.h $(ETAGS_TARGET) tags cscope*

apply.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef APPLY_H
22
#define APPLY_H
33

4+
#include "hash.h"
45
#include "lockfile.h"
56
#include "string-list.h"
67

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ jobs:
354354
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
355355
356356
sudo apt-get update &&
357-
sudo apt-get install -y coccinelle &&
357+
sudo apt-get install -y coccinelle libcurl4-openssl-dev libssl-dev libexpat-dev gettext &&
358358
359359
export jobname=StaticAnalysis &&
360360

ci/install-dependencies.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ osx-clang|osx-gcc)
4949
;;
5050
StaticAnalysis)
5151
sudo apt-get -q update
52-
sudo apt-get -q -y install coccinelle
52+
sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
53+
libexpat-dev gettext
5354
;;
5455
Documentation)
5556
sudo apt-get -q update

ci/run-static-analysis.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@ then
2626
exit 1
2727
fi
2828

29+
make hdr-check ||
30+
exit 1
31+
2932
save_good_tree

pack-bitmap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ struct commit;
99
struct repository;
1010
struct rev_info;
1111

12+
static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};
13+
1214
struct bitmap_disk_header {
13-
char magic[4];
15+
char magic[ARRAY_SIZE(BITMAP_IDX_SIGNATURE)];
1416
uint16_t version;
1517
uint16_t options;
1618
uint32_t entry_count;
1719
unsigned char checksum[GIT_MAX_RAWSZ];
1820
};
1921

20-
static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};
21-
2222
#define NEEDS_BITMAP (1u<<22)
2323

2424
enum pack_bitmap_opts {

promisor-remote.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef PROMISOR_REMOTE_H
22
#define PROMISOR_REMOTE_H
33

4+
#include "repository.h"
5+
46
struct object_id;
57

68
/*

0 commit comments

Comments
 (0)