Skip to content

Commit

Permalink
Merge branch 'dl/honor-cflags-in-hdr-check'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gitster committed Oct 7, 2019
2 parents 1f314d5 + 411e4f4 commit 9728ab4
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
/tags
/TAGS
/cscope*
*.hcc
*.obj
*.lib
*.res
Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,7 @@ ifndef V
QUIET_MSGFMT = @echo ' ' MSGFMT $@;
QUIET_GCOV = @echo ' ' GCOV $@;
QUIET_SP = @echo ' ' SP $<;
QUIET_HDR = @echo ' ' HDR $<;
QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
QUIET_RC = @echo ' ' RC $@;
QUIET_SUBDIR0 = +@subdir=
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
Expand Down Expand Up @@ -2788,9 +2788,14 @@ ifndef GCRYPT_SHA256
endif
CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
HCC = $(HCO:hco=hcc)

$(HCO): %.hco: %.h FORCE
$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $<
%.hcc: %.h
@echo '#include "git-compat-util.h"' >$@
@echo '#include "$<"' >>$@

$(HCO): %.hco: %.hcc FORCE
$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<

.PHONY: hdr-check $(HCO)
hdr-check: $(HCO)
Expand Down Expand Up @@ -3095,6 +3100,7 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
$(RM) $(TEST_PROGRAMS)
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(HCC)
$(RM) -r bin-wrappers $(dep_dirs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo command-list.h $(ETAGS_TARGET) tags cscope*
Expand Down
1 change: 1 addition & 0 deletions apply.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef APPLY_H
#define APPLY_H

#include "hash.h"
#include "lockfile.h"
#include "string-list.h"

Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ jobs:
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
sudo apt-get update &&
sudo apt-get install -y coccinelle &&
sudo apt-get install -y coccinelle libcurl4-openssl-dev libssl-dev libexpat-dev gettext &&
export jobname=StaticAnalysis &&
Expand Down
3 changes: 2 additions & 1 deletion ci/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ osx-clang|osx-gcc)
;;
StaticAnalysis)
sudo apt-get -q update
sudo apt-get -q -y install coccinelle
sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
libexpat-dev gettext
;;
Documentation)
sudo apt-get -q update
Expand Down
3 changes: 3 additions & 0 deletions ci/run-static-analysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ then
exit 1
fi

make hdr-check ||
exit 1

save_good_tree
6 changes: 3 additions & 3 deletions pack-bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ struct commit;
struct repository;
struct rev_info;

static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};

struct bitmap_disk_header {
char magic[4];
char magic[ARRAY_SIZE(BITMAP_IDX_SIGNATURE)];
uint16_t version;
uint16_t options;
uint32_t entry_count;
unsigned char checksum[GIT_MAX_RAWSZ];
};

static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};

#define NEEDS_BITMAP (1u<<22)

enum pack_bitmap_opts {
Expand Down
2 changes: 2 additions & 0 deletions promisor-remote.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef PROMISOR_REMOTE_H
#define PROMISOR_REMOTE_H

#include "repository.h"

struct object_id;

/*
Expand Down

0 comments on commit 9728ab4

Please sign in to comment.