Skip to content

Commit 793066e

Browse files
committed
Merge branch 'rj/sparse'
* rj/sparse: sparse: Fix some "symbol not declared" warnings sparse: Fix errors due to missing target-specific variables sparse: Fix an "symbol 'merge_file' not decared" warning sparse: Fix an "symbol 'format_subject' not declared" warning sparse: Fix some "Using plain integer as NULL pointer" warnings sparse: Fix an "symbol 'cmd_index_pack' not declared" warning Makefile: Use cgcc rather than sparse in the check target
2 parents 982f6c9 + c514772 commit 793066e

File tree

10 files changed

+50
-30
lines changed

10 files changed

+50
-30
lines changed

Makefile

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,7 @@ GCOV = gcov
323323

324324
export TCL_PATH TCLTK_PATH
325325

326-
# sparse is architecture-neutral, which means that we need to tell it
327-
# explicitly what architecture to check for. Fix this up for yours..
328-
SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
326+
SPARSE_FLAGS =
329327

330328

331329

@@ -527,6 +525,7 @@ LIB_H += list-objects.h
527525
LIB_H += ll-merge.h
528526
LIB_H += log-tree.h
529527
LIB_H += mailmap.h
528+
LIB_H += merge-file.h
530529
LIB_H += merge-recursive.h
531530
LIB_H += notes.h
532531
LIB_H += notes-cache.h
@@ -924,6 +923,7 @@ ifeq ($(uname_O),Cygwin)
924923
X = .exe
925924
COMPAT_OBJS += compat/cygwin.o
926925
UNRELIABLE_FSTAT = UnfortunatelyYes
926+
SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
927927
endif
928928
ifeq ($(uname_S),FreeBSD)
929929
NEEDS_LIBICONV = YesPlease
@@ -1177,6 +1177,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
11771177
EXTLIBS += -lws2_32
11781178
PTHREAD_LIBS =
11791179
X = .exe
1180+
SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
11801181
ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
11811182
htmldir=doc/git/html/
11821183
prefix =
@@ -1580,6 +1581,7 @@ ifndef V
15801581
QUIET_LNCP = @echo ' ' LN/CP $@;
15811582
QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
15821583
QUIET_GCOV = @echo ' ' GCOV $@;
1584+
QUIET_SP = @echo ' ' SP $<;
15831585
QUIET_SUBDIR0 = +@subdir=
15841586
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
15851587
$(MAKE) $(PRINT_DIR) -C $$subdir
@@ -1675,17 +1677,17 @@ strip: $(PROGRAMS) git$X
16751677
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
16761678

16771679
git.o: common-cmds.h
1678-
git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
1680+
git.sp git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
16791681
'-DGIT_HTML_PATH="$(htmldir_SQ)"'
16801682

16811683
git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
16821684
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
16831685
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
16841686

1685-
help.o: common-cmds.h
1687+
help.sp help.o: common-cmds.h
16861688

1687-
builtin/help.o: common-cmds.h
1688-
builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
1689+
builtin/help.sp builtin/help.o: common-cmds.h
1690+
builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
16891691
'-DGIT_HTML_PATH="$(htmldir_SQ)"' \
16901692
'-DGIT_MAN_PATH="$(mandir_SQ)"' \
16911693
'-DGIT_INFO_PATH="$(infodir_SQ)"'
@@ -1971,30 +1973,34 @@ $(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
19711973
test-svn-fe.o: vcs-svn/svndump.h
19721974
endif
19731975

1974-
exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
1976+
exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
19751977
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
19761978
'-DBINDIR="$(bindir_relative_SQ)"' \
19771979
'-DPREFIX="$(prefix_SQ)"'
19781980

1979-
builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
1981+
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
19801982
-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
19811983

1982-
config.s config.o: EXTRA_CPPFLAGS = -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
1984+
config.sp config.s config.o: EXTRA_CPPFLAGS = \
1985+
-DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
19831986

1984-
attr.s attr.o: EXTRA_CPPFLAGS = -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
1987+
attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
1988+
-DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
19851989

1986-
http.s http.o: EXTRA_CPPFLAGS = -DGIT_HTTP_USER_AGENT='"git/$(GIT_VERSION)"'
1990+
http.sp http.s http.o: EXTRA_CPPFLAGS = \
1991+
-DGIT_HTTP_USER_AGENT='"git/$(GIT_VERSION)"'
19871992

19881993
ifdef NO_EXPAT
1989-
http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
1994+
http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
19901995
endif
19911996

19921997
ifdef NO_REGEX
1993-
compat/regex/regex.o: EXTRA_CPPFLAGS = -DGAWK -DNO_MBSUPPORT
1998+
compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
1999+
-DGAWK -DNO_MBSUPPORT
19942000
endif
19952001

19962002
ifdef USE_NED_ALLOCATOR
1997-
compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
2003+
compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
19982004
-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
19992005
endif
20002006

@@ -2160,13 +2166,20 @@ test-%$X: test-%.o $(GITLIBS)
21602166
check-sha1:: test-sha1$X
21612167
./test-sha1.sh
21622168

2169+
SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
2170+
2171+
$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
2172+
$(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
2173+
$(SPARSE_FLAGS) $<
2174+
2175+
.PHONY: sparse $(SP_OBJ)
2176+
sparse: $(SP_OBJ)
2177+
21632178
check: common-cmds.h
2164-
if sparse; \
2179+
@if sparse; \
21652180
then \
2166-
for i in $(patsubst %.o, %.c, $(GIT_OBJS)); \
2167-
do \
2168-
sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
2169-
done; \
2181+
echo 2>&1 "Use 'make sparse' instead"; \
2182+
$(MAKE) --no-print-directory sparse; \
21702183
else \
21712184
echo 2>&1 "Did you mean 'make test'?"; \
21722185
exit 1; \

attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,15 @@ static void drop_attr_stack(void)
465465
}
466466
}
467467

468-
const char *git_etc_gitattributes(void)
468+
static const char *git_etc_gitattributes(void)
469469
{
470470
static const char *system_wide;
471471
if (!system_wide)
472472
system_wide = system_path(ETC_GITATTRIBUTES);
473473
return system_wide;
474474
}
475475

476-
int git_attr_system(void)
476+
static int git_attr_system(void)
477477
{
478478
return !git_env_bool("GIT_ATTR_NOSYSTEM", 0);
479479
}

builtin/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "cache.h"
1+
#include "builtin.h"
22
#include "delta.h"
33
#include "pack.h"
44
#include "csum-file.h"

builtin/merge-tree.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "xdiff-interface.h"
44
#include "blob.h"
55
#include "exec_cmd.h"
6+
#include "merge-file.h"
67

78
static const char merge_tree_usage[] = "git merge-tree <base-tree> <branch1> <branch2>";
89
static int resolve_directories = 1;
@@ -54,8 +55,6 @@ static const char *explanation(struct merge_list *entry)
5455
return "removed in remote";
5556
}
5657

57-
extern void *merge_file(const char *, struct blob *, struct blob *, struct blob *, unsigned long *);
58-
5958
static void *result(struct merge_list *entry, unsigned long *size)
6059
{
6160
enum object_type type;

builtin/shortlog.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ static int compare_by_number(const void *a1, const void *a2)
2929
return -1;
3030
}
3131

32-
const char *format_subject(struct strbuf *sb, const char *msg,
33-
const char *line_separator);
34-
3532
static void insert_one_record(struct shortlog *log,
3633
const char *author,
3734
const char *oneline)

commit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ extern char *logmsg_reencode(const struct commit *commit,
9090
extern char *reencode_commit_message(const struct commit *commit,
9191
const char **encoding_p);
9292
extern void get_commit_format(const char *arg, struct rev_info *);
93+
extern const char *format_subject(struct strbuf *sb, const char *msg,
94+
const char *line_separator);
9395
extern void userformat_find_requirements(const char *fmt, struct userformat_want *w);
9496
extern void format_commit_message(const struct commit *commit,
9597
const char *format, struct strbuf *sb,

imap-send.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,13 +1193,13 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
11931193
if (!preauth) {
11941194
#ifndef NO_OPENSSL
11951195
if (!srvc->use_ssl && CAP(STARTTLS)) {
1196-
if (imap_exec(ctx, 0, "STARTTLS") != RESP_OK)
1196+
if (imap_exec(ctx, NULL, "STARTTLS") != RESP_OK)
11971197
goto bail;
11981198
if (ssl_socket_connect(&imap->buf.sock, 1,
11991199
srvc->ssl_verify))
12001200
goto bail;
12011201
/* capabilities may have changed, so get the new capabilities */
1202-
if (imap_exec(ctx, 0, "CAPABILITY") != RESP_OK)
1202+
if (imap_exec(ctx, NULL, "CAPABILITY") != RESP_OK)
12031203
goto bail;
12041204
}
12051205
#endif

merge-file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "xdiff-interface.h"
44
#include "ll-merge.h"
55
#include "blob.h"
6+
#include "merge-file.h"
67

78
static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
89
{

merge-file.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef MERGE_FILE_H
2+
#define MERGE_FILE_H
3+
4+
extern void *merge_file(const char *path, struct blob *base, struct blob *our,
5+
struct blob *their, unsigned long *size);
6+
7+
#endif

vcs-svn/svndump.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "line_buffer.h"
1414
#include "string_pool.h"
1515
#include "strbuf.h"
16+
#include "svndump.h"
1617

1718
/*
1819
* Compare start of string to literal of equal length;

0 commit comments

Comments
 (0)